def test_strip_json_wrapper(self):
     json = "['contents']"
     self.assertEqual(
         json_results_generator.strip_json_wrapper(
             json_results_generator._JSON_PREFIX + json +
             json_results_generator._JSON_SUFFIX), json)
     self.assertEqual(json_results_generator.strip_json_wrapper(json), json)
 def test_strip_json_wrapper(self):
     json = "['contents']"
     self.assertEqual(
         json_results_generator.strip_json_wrapper(
             json_results_generator._JSON_PREFIX + json + json_results_generator._JSON_SUFFIX
         ),
         json,
     )
     self.assertEqual(json_results_generator.strip_json_wrapper(json), json)
 def test_gather_baselines(self):
     example_json = layouttestresults_unittest.LayoutTestResultsTest.example_full_results_json
     results_json = json.loads(strip_json_wrapper(example_json))
     server = RebaselineServer()
     server._test_config = get_test_config()
     server._gather_baselines(results_json)
     self.assertEqual(results_json['tests']['svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html']['state'], 'needs_rebaseline')
     self.assertNotIn('prototype-chocolate.html', results_json['tests'])
 def test_gather_baselines(self):
     example_json = resultsjsonparser_unittest.ResultsJSONParserTest._example_full_results_json
     results_json = json.loads(strip_json_wrapper(example_json))
     server = RebaselineServer()
     server._test_config = get_test_config()
     server._gather_baselines(results_json)
     self.assertEqual(results_json['tests']['svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html']['state'], 'needs_rebaseline')
     self.assertFalse('prototype-chocolate.html' in results_json['tests'])
Пример #5
0
    def results_from_string(cls, string):
        if not string:
            return None

        content_string = json_results_generator.strip_json_wrapper(string)
        json_dict = json.loads(content_string)
        if not json_dict:
            return None
        return cls(json_dict)
 def test_gather_baselines(self):
     example_json = resultsjsonparser_unittest.ResultsJSONParserTest._example_full_results_json
     results_json = json.loads(strip_json_wrapper(example_json))
     server = RebaselineServer()
     server._test_config = get_test_config()
     server._gather_baselines(results_json)
     self.assertEqual(
         results_json["tests"]["svg/dynamic-updates/SVGFEDropShadowElement-dom-stdDeviation-attr.html"]["state"],
         "needs_rebaseline",
     )
     self.assertNotIn("prototype-chocolate.html", results_json["tests"])
Пример #7
0
    def parse_results_json(cls, json_string):
        if not json_results_generator.has_json_wrapper(json_string):
            return None

        content_string = json_results_generator.strip_json_wrapper(json_string)
        json_dict = json.loads(content_string)

        json_results = []
        for_each_test(json_dict['tests'], lambda test, result: json_results.append(JSONTestResult(test, result)))

        # FIXME: What's the short sexy python way to filter None?
        # I would use [foo.bar() for foo in foos if foo.bar()] but bar() is expensive.
        unexpected_failures = [result.test_result() for result in json_results if not result.did_pass_or_run_as_expected()]
        return filter(lambda a: a, unexpected_failures)
Пример #8
0
    def parse_results_json(cls, json_string):
        if not json_results_generator.has_json_wrapper(json_string):
            return None

        content_string = json_results_generator.strip_json_wrapper(json_string)
        json_dict = json.loads(content_string)

        json_results = []
        for_each_test(json_dict['tests'], lambda test, result: json_results.append(JSONTestResult(test, result)))

        # FIXME: What's the short sexy python way to filter None?
        # I would use [foo.bar() for foo in foos if foo.bar()] but bar() is expensive.
        unexpected_failures = [result.test_result() for result in json_results if not result.did_pass_or_run_as_expected()]
        return filter(lambda a: a, unexpected_failures)
Пример #9
0
    def results_from_string(cls, string, chromium_revision=None):
        """Creates a LayoutTestResults object from a test result JSON string.

        Args:
            string: JSON string containg layout test result.
            chromium_revision: If given, it will override the chromium_revision
                field in json, to indicate the last revision that has completed
                uploading onto the storage server. chromium_revision can be a
                git hash or position number.
        """

        if not string:
            return None

        content_string = json_results_generator.strip_json_wrapper(string)
        json_dict = json.loads(content_string)
        if not json_dict:
            return None

        return cls(json_dict, chromium_revision)
Пример #10
0
    def results_from_string(cls, string, chromium_revision=None):
        """Creates a LayoutTestResults object from a test result JSON string.

        Args:
            string: JSON string containing layout test result.
            chromium_revision: If given, it will override the chromium_revision
                field in json, to indicate the last revision that has completed
                uploading onto the storage server. chromium_revision can be a
                git hash or position number.
        """

        if not string:
            return None

        content_string = json_results_generator.strip_json_wrapper(string)
        json_dict = json.loads(content_string)
        if not json_dict:
            return None

        return cls(json_dict, chromium_revision)
Пример #11
0
    def __init__(self, json_string):
        if not json_results_generator.has_json_wrapper(json_string):
            return None

        content_string = json_results_generator.strip_json_wrapper(json_string)
        json_dict = json.loads(content_string)

        json_results = []
        for_each_test(json_dict['tests'], lambda test, result: json_results.append(JSONTestResult(test, result)))

        unexpected_failures = []
        for json_result in json_results:
            if json_result.did_pass_or_run_as_expected():
                continue
            test_result = json_result.test_result()
            if test_result:
                unexpected_failures.append(test_result)

        self._test_results = unexpected_failures
        self._did_exceed_test_failure_limit = json_dict["interrupted"]
    def __init__(self, json_string):
        if not json_results_generator.has_json_wrapper(json_string):
            return None

        content_string = json_results_generator.strip_json_wrapper(json_string)
        json_dict = json.loads(content_string)

        json_results = []
        for_each_test(
            json_dict['tests'], lambda test, result: json_results.append(
                JSONTestResult(test, result)))

        unexpected_failures = []
        for json_result in json_results:
            if json_result.did_pass_or_run_as_expected():
                continue
            test_result = json_result.test_result()
            if test_result:
                unexpected_failures.append(test_result)

        self._test_results = unexpected_failures
        self._did_exceed_test_failure_limit = json_dict["interrupted"]