mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-21 01:05:45 +00:00
Backed out changeset 86bc425ccdbd (bug 1066323) for failing logtypes.py on a CLOSED TREE
This commit is contained in:
parent
ad43843276
commit
e544d76126
@ -21,7 +21,6 @@ class log_action(object):
|
||||
|
||||
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
|
||||
@ -39,9 +38,6 @@ class log_action(object):
|
||||
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)
|
||||
|
||||
@ -98,10 +94,7 @@ class log_action(object):
|
||||
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)
|
||||
|
||||
@ -113,8 +106,6 @@ class log_action(object):
|
||||
return self.convert(**known_kwargs)
|
||||
|
||||
|
||||
|
||||
|
||||
class DataType(object):
|
||||
|
||||
def __init__(self, name, default=no_default, optional=False):
|
||||
|
@ -230,8 +230,7 @@ class StructuredLogger(object):
|
||||
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)
|
||||
|
@ -257,26 +257,6 @@ class TestStructuredLog(BaseStructuredTest):
|
||||
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")
|
||||
|
Loading…
Reference in New Issue
Block a user