当前位置: 首页>>代码示例>>Python>>正文


Python test_result_writer.write_test_result函数代码示例

本文整理汇总了Python中webkitpy.layout_tests.controllers.test_result_writer.write_test_result函数的典型用法代码示例。如果您正苦于以下问题:Python write_test_result函数的具体用法?Python write_test_result怎么用?Python write_test_result使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了write_test_result函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: _run_reftest

    def _run_reftest(self):
        test_output = self._driver.run_test(self._driver_input(), self._stop_when_done)
        total_test_time = 0
        reference_output = None
        test_result = None

        # If the test crashed, or timed out, there's no point in running the reference at all.
        # This can save a lot of execution time if we have a lot of crashes or timeouts.
        if test_output.crash or test_output.timeout:
            expected_driver_output = DriverOutput(text=None, image=None, image_hash=None, audio=None)
            return self._compare_output(expected_driver_output, test_output)

        # A reftest can have multiple match references and multiple mismatch references;
        # the test fails if any mismatch matches and all of the matches don't match.
        # To minimize the number of references we have to check, we run all of the mismatches first,
        # then the matches, and short-circuit out as soon as we can.
        # Note that sorting by the expectation sorts "!=" before "==" so this is easy to do.

        putAllMismatchBeforeMatch = sorted
        reference_test_names = []
        for expectation, reference_filename in putAllMismatchBeforeMatch(self._reference_files):
            reference_test_name = self._port.relative_test_filename(reference_filename)
            reference_test_names.append(reference_test_name)
            reference_output = self._driver.run_test(
                DriverInput(reference_test_name, self._timeout, None, should_run_pixel_test=True), self._stop_when_done
            )
            test_result = self._compare_output_with_reference(
                reference_output, test_output, reference_filename, expectation == "!="
            )

            if (expectation == "!=" and test_result.failures) or (expectation == "==" and not test_result.failures):
                break
            total_test_time += test_result.test_run_time

        assert reference_output
        test_result_writer.write_test_result(
            self._filesystem,
            self._port,
            self._results_directory,
            self._test_name,
            test_output,
            reference_output,
            test_result.failures,
        )

        # FIXME: We don't really deal with a mix of reftest types properly. We pass in a set() to reftest_type
        # and only really handle the first of the references in the result.
        reftest_type = list(set([reference_file[0] for reference_file in self._reference_files]))
        return TestResult(
            self._test_name,
            test_result.failures,
            total_test_time + test_result.test_run_time,
            test_result.has_stderr,
            reftest_type=reftest_type,
            pid=test_result.pid,
            references=reference_test_names,
            device_offline=reference_output.device_offline,
        )
开发者ID:rzr,项目名称:Tizen_Crosswalk,代码行数:58,代码来源:single_test_runner.py

示例2: _run_compare_test

    def _run_compare_test(self):
        driver_output = self._driver.run_test(self._driver_input(), self._stop_when_done)
        expected_driver_output = self._expected_driver_output()

        test_result = self._compare_output(expected_driver_output, driver_output)
        if self._should_add_missing_baselines:
            self._add_missing_baselines(test_result, driver_output)
        test_result_writer.write_test_result(self._filesystem, self._port, self._results_directory, self._test_name, driver_output, expected_driver_output, test_result.failures)
        return test_result
开发者ID:esprehn,项目名称:mojo,代码行数:9,代码来源:single_test_runner.py

示例3: run_test

 def run_test(self, failures=None, files=None):
     failures = failures or []
     host = MockSystemHost()
     host.filesystem.files = files or {}
     port = TestPort(host=host, port_name='test-mac-mac10.11', options=optparse.Values())
     actual_output = DriverOutput(text='', image=None, image_hash=None, audio=None)
     expected_output = DriverOutput(text='', image=None, image_hash=None, audio=None)
     write_test_result(host.filesystem, port, '/tmp', 'foo.html', actual_output, expected_output, failures)
     return host.filesystem.written_files
开发者ID:aobzhirov,项目名称:ChromiumGStreamerBackend,代码行数:9,代码来源:test_result_writer_unittest.py

示例4: _run_sanitized_test

 def _run_sanitized_test(self):
     # running a sanitized test means that we ignore the actual test output and just look
     # for timeouts and crashes (real or forced by the driver). Most crashes should
     # indicate problems found by a sanitizer (ASAN, LSAN, etc.), but we will report
     # on other crashes and timeouts as well in order to detect at least *some* basic failures.
     driver_output = self._driver.run_test(self._driver_input(), self._stop_when_done)
     expected_driver_output = self._expected_driver_output()
     failures = self._handle_error(driver_output)
     test_result = TestResult(self._test_name, failures, driver_output.test_time, driver_output.has_stderr(),
                              pid=driver_output.pid)
     test_result_writer.write_test_result(self._filesystem, self._port, self._results_directory, self._test_name, driver_output, expected_driver_output, test_result.failures)
     return test_result
开发者ID:joone,项目名称:chromium-crosswalk,代码行数:12,代码来源:single_test_runner.py

示例5: _run_compare_test

    def _run_compare_test(self):
        driver_output = self._driver.run_test(self._driver_input(), self._stop_when_done)
        expected_driver_output = self._expected_driver_output()

        if self._options.ignore_metrics:
            expected_driver_output.strip_metrics()
            driver_output.strip_metrics()

        patterns = self._port.logging_patterns_to_strip()
        expected_driver_output.strip_patterns(patterns)
        driver_output.strip_patterns(patterns)

        test_result = self._compare_output(expected_driver_output, driver_output)
        if self._options.new_test_results:
            self._add_missing_baselines(test_result, driver_output)
        test_result_writer.write_test_result(self._filesystem, self._port, self._results_directory, self._test_name, driver_output, expected_driver_output, test_result.failures)
        return test_result
开发者ID:Happy-Ferret,项目名称:webkit.js,代码行数:17,代码来源:single_test_runner.py

示例6: test_reftest_diff_image

    def test_reftest_diff_image(self):
        """A write_test_result should call port.diff_image with tolerance=0 in case of FailureReftestMismatch."""
        used_tolerance_values = []

        class ImageDiffTestPort(TestPort):
            def diff_image(self, expected_contents, actual_contents, tolerance=None):
                used_tolerance_values.append(tolerance)
                return (True, 1, None)

        host = MockHost()
        port = ImageDiffTestPort(host)
        test_name = 'failures/unexpected/reftest.html'
        test_reference_file = host.filesystem.join(port.layout_tests_dir(), 'failures/unexpected/reftest-expected.html')
        driver_output1 = DriverOutput('text1', 'image1', 'imagehash1', 'audio1')
        driver_output2 = DriverOutput('text2', 'image2', 'imagehash2', 'audio2')
        failures = [test_failures.FailureReftestMismatch(test_reference_file)]
        test_result_writer.write_test_result(host.filesystem, ImageDiffTestPort(host), port.results_directory(), test_name,
                                             driver_output1, driver_output2, failures)
        self.assertEqual([0], used_tolerance_values)
开发者ID:3163504123,项目名称:phantomjs,代码行数:19,代码来源:test_result_writer_unittest.py


注:本文中的webkitpy.layout_tests.controllers.test_result_writer.write_test_result函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。