Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(159)

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py

Issue 1806393002: Run yapf on files in webkit/layout_tests/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
index 46041d631483451ea67ee6db30f84c076cec0e3e..307720efc1d68d0b21cd7e29068c8af34ed225c5 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/controllers/layout_test_runner.py
@@ -38,10 +38,8 @@ from webkitpy.layout_tests.models import test_failures
from webkitpy.layout_tests.models import test_results
from webkitpy.tool import grammar
-
_log = logging.getLogger(__name__)
-
TestExpectations = test_expectations.TestExpectations
# Export this so callers don't need to know about message pools.
@@ -50,13 +48,14 @@ WorkerException = message_pool.WorkerException
class TestRunInterruptedException(Exception):
"""Raised when a test run should be stopped immediately."""
+
def __init__(self, reason):
Exception.__init__(self)
self.reason = reason
self.msg = reason
def __reduce__(self):
- return self.__class__, (self.reason,)
+ return self.__class__, (self.reason, )
class LayoutTestRunner(object):
@@ -96,9 +95,9 @@ class LayoutTestRunner(object):
run_results.add(result, expected=True, test_is_slow=self._test_is_slow(test_name))
self._printer.write_update('Sharding tests ...')
- locked_shards, unlocked_shards = self._sharder.shard_tests(test_inputs,
- int(self._options.child_processes), self._options.fully_parallel,
- self._options.run_singly or (self._options.batch_size == 1))
+ locked_shards, unlocked_shards = self._sharder.shard_tests(test_inputs, int(self._options.child_processes),
+ self._options.fully_parallel, self._options.run_singly or
+ (self._options.batch_size == 1))
# We don't have a good way to coordinate the workers so that they don't
# try to run the shards that need a lock. The easiest solution is to
@@ -142,8 +141,7 @@ class LayoutTestRunner(object):
def _worker_factory(self, worker_connection):
results_directory = self._results_directory
if self._retry_attempt > 0:
- results_directory = self._filesystem.join(self._results_directory,
- 'retry_%d' % self._retry_attempt)
+ results_directory = self._filesystem.join(self._results_directory, 'retry_%d' % self._retry_attempt)
self._filesystem.maybe_make_directory(results_directory)
return Worker(worker_connection, results_directory, self._options)
@@ -165,20 +163,18 @@ class LayoutTestRunner(object):
self._mark_interrupted_tests_as_skipped(run_results)
raise TestRunInterruptedException(message)
- interrupt_if_at_failure_limit(
- self._options.exit_after_n_failures,
- run_results.unexpected_failures,
- run_results,
- "Exiting early after %d failures." % run_results.unexpected_failures)
- interrupt_if_at_failure_limit(
- self._options.exit_after_n_crashes_or_timeouts,
- run_results.unexpected_crashes + run_results.unexpected_timeouts,
- run_results,
- # This differs from ORWT because it does not include WebProcess crashes.
- "Exiting early after %d crashes and %d timeouts." % (run_results.unexpected_crashes, run_results.unexpected_timeouts))
+ interrupt_if_at_failure_limit(self._options.exit_after_n_failures, run_results.unexpected_failures, run_results,
+ "Exiting early after %d failures." % run_results.unexpected_failures)
+ interrupt_if_at_failure_limit(self._options.exit_after_n_crashes_or_timeouts,
+ run_results.unexpected_crashes + run_results.unexpected_timeouts,
+ run_results,
+ # This differs from ORWT because it does not include WebProcess crashes.
+ "Exiting early after %d crashes and %d timeouts." %
+ (run_results.unexpected_crashes, run_results.unexpected_timeouts))
def _update_summary_with_result(self, run_results, result):
- expected = self._expectations.matches_an_expected_result(result.test_name, result.type, self._options.pixel_tests or result.reftest_type, self._options.enable_sanitizer)
+ expected = self._expectations.matches_an_expected_result(result.test_name, result.type, self._options.pixel_tests or
+ result.reftest_type, self._options.enable_sanitizer)
exp_str = self._expectations.get_expectations_string(result.test_name)
got_str = self._expectations.expectation_to_string(result.type)
@@ -284,10 +280,8 @@ class Worker(object):
_log.debug("%s %s started" % (self._name, test_input.test_name))
self._caller.post('started_test', test_input)
- result = single_test_runner.run_single_test(
- self._port, self._options, self._results_directory, self._name,
- self._primary_driver, self._secondary_driver, test_input,
- stop_when_done)
+ result = single_test_runner.run_single_test(self._port, self._options, self._results_directory, self._name,
+ self._primary_driver, self._secondary_driver, test_input, stop_when_done)
result.shard_name = shard_name
result.worker_name = self._name
@@ -422,7 +416,7 @@ class Sharder(object):
# The locked shards still need to be limited to self._max_locked_shards in order to not
# overload the http server for the http tests.
return (self._resize_shards(locked_virtual_shards + locked_shards, self._max_locked_shards, 'locked_shard'),
- unlocked_virtual_shards + unlocked_shards)
+ unlocked_virtual_shards + unlocked_shards)
def _shard_by_directory(self, test_inputs):
"""Returns two lists of shards, each shard containing all the files in a directory.
@@ -464,8 +458,7 @@ class Sharder(object):
# can handle multiple shards, we should probably do something like
# limit this to no more than a quarter of all workers, e.g.:
# return max(math.ceil(num_workers / 4.0), 1)
- return (self._resize_shards(locked_shards, self._max_locked_shards, 'locked_shard'),
- unlocked_slow_shards + unlocked_shards)
+ return (self._resize_shards(locked_shards, self._max_locked_shards, 'locked_shard'), unlocked_slow_shards + unlocked_shards)
def _resize_shards(self, old_shards, max_new_shards, shard_name_prefix):
"""Takes a list of shards and redistributes the tests into no more

Powered by Google App Engine
This is Rietveld 408576698