Backed out changeset 86bc425ccdbd (bug 1066323) for failing logtypes.py on a CLOSED TREE
authorAndreea Pavel <apavel@mozilla.com>
Tue, 21 May 2019 19:11:48 +0300
changeset 474768 a45257ffaf572e39c87ded7bd2ee065d310f3bda
parent 474767 5e9337e9c2adf5988bc3a333567b570cfeb5b7a7
child 474769 ea3552a1c04093f444af1c64228727341e8cce05
push id36046
push useraiakab@mozilla.com
push dateTue, 21 May 2019 21:45:52 +0000
treeherdermozilla-central@257f2c96cef5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1066323
milestone69.0a1
backs out86bc425ccdbd6573888fa0f1b0fe29600b67ac78
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset 86bc425ccdbd (bug 1066323) for failing logtypes.py on a CLOSED TREE
testing/mozbase/mozlog/mozlog/logtypes.py
testing/mozbase/mozlog/mozlog/structuredlog.py
testing/mozbase/mozlog/tests/test_structured.py
--- a/testing/mozbase/mozlog/mozlog/logtypes.py
+++ b/testing/mozbase/mozlog/mozlog/logtypes.py
@@ -16,17 +16,16 @@ no_default = object()
 
 class log_action(object):
 
     def __init__(self, *args):
         self.args = {}
 
         self.args_no_default = []
         self.args_with_default = []
-        self.optional_args = set()
 
         # These are the required fields in a log message that usually aren't
         # supplied by the caller, but can be in the case of log_raw
         self.default_args = [
             Unicode("action"),
             Int("time"),
             Unicode("thread"),
             Int("pid", default=None),
@@ -34,19 +33,16 @@ class log_action(object):
             Unicode("component")]
 
         for arg in args:
             if arg.default is no_default:
                 self.args_no_default.append(arg.name)
             else:
                 self.args_with_default.append(arg.name)
 
-            if arg.optional:
-                self.optional_args.add(arg.name)
-
             if arg.name in self.args:
                 raise ValueError("Repeated argument name %s" % arg.name)
 
             self.args[arg.name] = arg
 
         for extra in self.default_args:
             self.args[extra.name] = extra
 
@@ -93,33 +89,28 @@ class log_action(object):
         for name in self.args_with_default:
             if name not in values:
                 values[name] = self.args[name].default
 
         for key, value in six.iteritems(values):
             if key in self.args:
                 out_value = self.args[key](value)
                 if out_value is not missing:
-                    if (key in self.optional_args and value == self.args[key].default):
-                        pass
-                    else:
-                        data[key] = out_value
+                    data[key] = out_value
             else:
                 raise TypeError("Unrecognised argument %s" % key)
 
         return data
 
     def convert_known(self, **kwargs):
         known_kwargs = {name: value for name, value in six.iteritems(kwargs)
                         if name in self.args}
         return self.convert(**known_kwargs)
 
 
-
-
 class DataType(object):
 
     def __init__(self, name, default=no_default, optional=False):
         self.name = name
         self.default = default
 
         if default is no_default and optional is not False:
             raise ValueError("optional arguments require a default value")
--- a/testing/mozbase/mozlog/mozlog/structuredlog.py
+++ b/testing/mozbase/mozlog/mozlog/structuredlog.py
@@ -225,18 +225,17 @@ class StructuredLogger(object):
 
     def log_raw(self, raw_data):
         if "action" not in raw_data:
             raise ValueError
 
         action = raw_data["action"]
         converted_data = convertor_registry[action].convert_known(**raw_data)
         for k, v in six.iteritems(raw_data):
-            if (k not in converted_data and
-                    k not in convertor_registry[action].optional_args):
+            if k not in converted_data:
                 converted_data[k] = v
 
         data = self._make_log_data(action, converted_data)
 
         if action in ("test_status", "test_end"):
             if (data["expected"] == data["status"] or
                 data["status"] == "SKIP" or
                     "expected" not in raw_data):
--- a/testing/mozbase/mozlog/tests/test_structured.py
+++ b/testing/mozbase/mozlog/tests/test_structured.py
@@ -252,36 +252,16 @@ class TestStructuredLog(BaseStructuredTe
         self.logger.test_end("test1", "OK")
         self.logger.suite_end()
 
     def test_status_not_started(self):
         self.logger.test_status("test_UNKNOWN", "subtest", "PASS")
         self.assertTrue(self.pop_last_item()["message"].startswith(
             "test_status for test_UNKNOWN logged while not in progress. Logged with data: {"))
 
-    def test_remove_optional_defaults(self):
-        self.logger.suite_start([])
-        self.logger.test_start("test1")
-        self.logger.test_status("test1", "subtest name", "fail", message=None, stack=None)
-        self.assert_log_equals({"action": "test_status",
-                                "subtest": "subtest name",
-                                "status": "FAIL",
-                                "expected": "PASS",
-                                "test": "test1"})
-        self.logger.test_end("test1", "OK")
-        self.logger.suite_end()
-
-    def test_remove_optional_defaults_raw_log(self):
-        self.logger.log_raw({"action": "suite_start",
-                             "tests": [1],
-                             "name": None})
-        self.assert_log_equals({"action": "suite_start",
-                                "tests": {"default": ["1"]}})
-        self.logger.suite_end()
-
     def test_end(self):
         self.logger.suite_start([])
         self.logger.test_start("test1")
         self.logger.test_end("test1", "fail", message="Test message")
         self.assert_log_equals({"action": "test_end",
                                 "status": "FAIL",
                                 "expected": "OK",
                                 "message": "Test message",