本文整理汇总了Python中webkitpy.layout_tests.controllers.layout_test_runner.LayoutTestRunner.run_tests方法的典型用法代码示例。如果您正苦于以下问题:Python LayoutTestRunner.run_tests方法的具体用法?Python LayoutTestRunner.run_tests怎么用?Python LayoutTestRunner.run_tests使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类webkitpy.layout_tests.controllers.layout_test_runner.LayoutTestRunner
的用法示例。
在下文中一共展示了LayoutTestRunner.run_tests方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Manager
# 需要导入模块: from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunner [as 别名]
# 或者: from webkitpy.layout_tests.controllers.layout_test_runner.LayoutTestRunner import run_tests [as 别名]
#.........这里部分代码省略.........
"""Run all our tests on all our test files and return the number of unexpected results (0 == success)."""
self._printer.write_update("Collecting tests ...")
try:
self._paths, self._test_names = self._collect_tests(args)
except IOError as exception:
# This is raised if --test-list doesn't exist
return -1
self._printer.write_update("Parsing expectations ...")
self._expectations = test_expectations.TestExpectations(
self._port, self._test_names)
num_all_test_files_found = len(self._test_names)
result_summary = self._prepare_lists()
# Check to make sure we're not skipping every test.
if not self._test_names:
_log.critical('No tests to run.')
return -1
self._printer.print_found(num_all_test_files_found,
len(self._test_names),
self._options.repeat_each,
self._options.iterations)
self._printer.print_expected(
result_summary, self._expectations.get_tests_with_result_type)
if not self._set_up_run():
return -1
start_time = time.time()
interrupted, keyboard_interrupted, thread_timings, test_timings, individual_test_timings = \
self._run_tests(self._test_names, result_summary, int(self._options.child_processes))
# We exclude the crashes from the list of results to retry, because
# we want to treat even a potentially flaky crash as an error.
failures = self._get_failures(
result_summary,
include_crashes=self._port.should_retry_crashes(),
include_missing=False)
retry_summary = result_summary
while (len(failures) and self._options.retry_failures
and not self._retrying and not interrupted
and not keyboard_interrupted):
_log.info('')
_log.info("Retrying %d unexpected failure(s) ..." % len(failures))
_log.info('')
self._retrying = True
retry_summary = ResultSummary(self._expectations, failures.keys(),
1, set())
# Note that we intentionally ignore the return value here.
self._run_tests(failures.keys(), retry_summary, 1)
failures = self._get_failures(
retry_summary, include_crashes=True, include_missing=True)
end_time = time.time()
# Some crash logs can take a long time to be written out so look
# for new logs after the test run finishes.
self._look_for_new_crash_logs(result_summary, start_time)
self._look_for_new_crash_logs(retry_summary, start_time)
self._clean_up_run()
unexpected_results = summarize_results(
示例2: Manager
# 需要导入模块: from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunner [as 别名]
# 或者: from webkitpy.layout_tests.controllers.layout_test_runner.LayoutTestRunner import run_tests [as 别名]
#.........这里部分代码省略.........
self._clobber_old_results()
# Create the output directory if it doesn't already exist.
self._port.host.filesystem.maybe_make_directory(self._results_directory)
self._port.setup_test_run()
return True
def run(self, args):
"""Run the tests and return a RunDetails object with the results."""
self._printer.write_update("Collecting tests ...")
try:
paths, test_names = self._collect_tests(args)
except IOError:
# This is raised if --test-list doesn't exist
return test_run_results.RunDetails(exit_code=-1)
self._printer.write_update("Parsing expectations ...")
self._expectations = test_expectations.TestExpectations(self._port, test_names)
tests_to_run, tests_to_skip = self._prepare_lists(paths, test_names)
self._printer.print_found(len(test_names), len(tests_to_run), self._options.repeat_each, self._options.iterations)
# Check to make sure we're not skipping every test.
if not tests_to_run:
_log.critical('No tests to run.')
return test_run_results.RunDetails(exit_code=-1)
if not self._set_up_run(tests_to_run):
return test_run_results.RunDetails(exit_code=-1)
start_time = time.time()
try:
initial_results = self._run_tests(tests_to_run, tests_to_skip, self._options.repeat_each, self._options.iterations,
int(self._options.child_processes), retrying=False)
tests_to_retry = self._tests_to_retry(initial_results, include_crashes=self._port.should_retry_crashes())
if self._options.retry_failures and tests_to_retry and not initial_results.interrupted:
_log.info('')
_log.info("Retrying %d unexpected failure(s) ..." % len(tests_to_retry))
_log.info('')
retry_results = self._run_tests(tests_to_retry, tests_to_skip=set(), repeat_each=1, iterations=1,
num_workers=1, retrying=True)
else:
retry_results = None
finally:
self._clean_up_run()
end_time = time.time()
# Some crash logs can take a long time to be written out so look
# for new logs after the test run finishes.
self._look_for_new_crash_logs(initial_results, start_time)
if retry_results:
self._look_for_new_crash_logs(retry_results, start_time)
summarized_results = test_run_results.summarize_results(self._port, self._expectations, initial_results, retry_results)
self._printer.print_results(end_time - start_time, initial_results, summarized_results)
if not self._options.dry_run:
self._port.print_leaks_summary()
self._upload_json_files(summarized_results, initial_results)
results_path = self._filesystem.join(self._results_directory, "results.html")
self._copy_results_html_file(results_path)
if self._options.show_results and (initial_results.unexpected_results_by_name or
示例3: Manager
# 需要导入模块: from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunner [as 别名]
# 或者: from webkitpy.layout_tests.controllers.layout_test_runner.LayoutTestRunner import run_tests [as 别名]
#.........这里部分代码省略.........
# Create the output directory if it doesn't already exist.
self._port.host.filesystem.maybe_make_directory(self._results_directory)
self._port.setup_test_run()
return True
def run(self, args):
"""Run the tests and return a RunDetails object with the results."""
self._printer.write_update("Collecting tests ...")
try:
paths, test_names = self._collect_tests(args)
except IOError:
# This is raised if --test-list doesn't exist
return test_run_results.RunDetails(exit_code=-1)
self._printer.write_update("Parsing expectations ...")
self._expectations = test_expectations.TestExpectations(self._port, test_names, force_expectations_pass=self._options.force)
self._expectations.parse_all_expectations()
tests_to_run, tests_to_skip = self._prepare_lists(paths, test_names)
self._printer.print_found(len(test_names), len(tests_to_run), self._options.repeat_each, self._options.iterations)
start_time = time.time()
# Check to make sure we're not skipping every test.
if not tests_to_run:
_log.critical('No tests to run.')
return test_run_results.RunDetails(exit_code=-1)
try:
if not self._set_up_run(tests_to_run):
return test_run_results.RunDetails(exit_code=-1)
enabled_pixel_tests_in_retry = False
initial_results = self._run_tests(tests_to_run, tests_to_skip, self._options.repeat_each, self._options.iterations,
int(self._options.child_processes), retrying=False)
tests_to_retry = self._tests_to_retry(initial_results, include_crashes=self._port.should_retry_crashes())
# Don't retry failures when interrupted by user or failures limit exception.
retry_failures = self._options.retry_failures and not (initial_results.interrupted or initial_results.keyboard_interrupted)
if retry_failures and tests_to_retry:
enabled_pixel_tests_in_retry = self._force_pixel_tests_if_needed()
_log.info('')
_log.info("Retrying %s ..." % pluralize(len(tests_to_retry), "unexpected failure"))
_log.info('')
retry_results = self._run_tests(tests_to_retry, tests_to_skip=set(), repeat_each=1, iterations=1,
num_workers=1, retrying=True)
if enabled_pixel_tests_in_retry:
self._options.pixel_tests = False
else:
retry_results = None
finally:
self._clean_up_run()
end_time = time.time()
# Some crash logs can take a long time to be written out so look
# for new logs after the test run finishes.
_log.debug("looking for new crash logs")
self._look_for_new_crash_logs(initial_results, start_time)
if retry_results:
self._look_for_new_crash_logs(retry_results, start_time)
_log.debug("summarizing results")
summarized_results = test_run_results.summarize_results(self._port, self._expectations, initial_results, retry_results, enabled_pixel_tests_in_retry)
示例4: Manager
# 需要导入模块: from webkitpy.layout_tests.controllers.layout_test_runner import LayoutTestRunner [as 别名]
# 或者: from webkitpy.layout_tests.controllers.layout_test_runner.LayoutTestRunner import run_tests [as 别名]
#.........这里部分代码省略.........
try:
paths, test_names = self._collect_tests(args)
except IOError:
# This is raised if --test-list doesn't exist
return test_run_results.RunDetails(exit_code=test_run_results.NO_TESTS_EXIT_STATUS)
self._printer.write_update("Parsing expectations ...")
self._expectations = test_expectations.TestExpectations(self._port, test_names)
tests_to_run, tests_to_skip = self._prepare_lists(paths, test_names)
self._printer.print_found(
len(test_names), len(tests_to_run), self._options.repeat_each, self._options.iterations
)
# Check to make sure we're not skipping every test.
if not tests_to_run:
_log.critical("No tests to run.")
return test_run_results.RunDetails(exit_code=test_run_results.NO_TESTS_EXIT_STATUS)
exit_code = self._set_up_run(tests_to_run)
if exit_code:
return test_run_results.RunDetails(exit_code=exit_code)
# Don't retry failures if an explicit list of tests was passed in.
if self._options.retry_failures is None:
should_retry_failures = len(paths) < len(test_names)
else:
should_retry_failures = self._options.retry_failures
enabled_pixel_tests_in_retry = False
try:
self._start_servers(tests_to_run)
initial_results = self._run_tests(
tests_to_run,
tests_to_skip,
self._options.repeat_each,
self._options.iterations,
self._port.num_workers(int(self._options.child_processes)),
retrying=False,
)
# Don't retry failures when interrupted by user or failures limit exception.
should_retry_failures = should_retry_failures and not (
initial_results.interrupted or initial_results.keyboard_interrupted
)
tests_to_retry = self._tests_to_retry(initial_results)
if should_retry_failures and tests_to_retry:
enabled_pixel_tests_in_retry = self._force_pixel_tests_if_needed()
_log.info("")
_log.info("Retrying %d unexpected failure(s) ..." % len(tests_to_retry))
_log.info("")
retry_results = self._run_tests(
tests_to_retry, tests_to_skip=set(), repeat_each=1, iterations=1, num_workers=1, retrying=True
)
if enabled_pixel_tests_in_retry:
self._options.pixel_tests = False
else:
retry_results = None
finally:
self._stop_servers()
self._clean_up_run()