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

Unified Diff: Tools/Scripts/webkitpy/layout_tests/layout_tests_mover.py

Issue 546133003: Reformat webkitpy.layout_tests w/ format-webkitpy. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 3 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: Tools/Scripts/webkitpy/layout_tests/layout_tests_mover.py
diff --git a/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover.py b/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover.py
index d5899251aeab57a8d3de97de06b7a861baf2bebf..02673d0f7c31bc1edaebbe717246f32f3b55d00a 100755
--- a/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover.py
+++ b/Tools/Scripts/webkitpy/layout_tests/layout_tests_mover.py
@@ -63,6 +63,7 @@ _log.setLevel(logging.INFO)
PLATFORM_DIRECTORY = 'platform'
+
class LayoutTestsMover(object):
def __init__(self, port=None):
@@ -110,7 +111,7 @@ class LayoutTestsMover(object):
for file_path in self._filesystem.listdir(self._absolute_origin):
if self._filesystem.exists(self._filesystem.join(self._absolute_destination, file_path)):
raise Exception('Origin path %s clashes with existing destination path %s' %
- (self._filesystem.join(self._origin, file_path), self._filesystem.join(self._destination, file_path)))
+ (self._filesystem.join(self._origin, file_path), self._filesystem.join(self._destination, file_path)))
def _get_expectations_for_test(self, model, test_path):
"""Given a TestExpectationsModel object, finds all expectations that match the specified
@@ -136,7 +137,12 @@ class LayoutTestsMover(object):
expectations = set()
for test in self._filesystem.files_under(self._filesystem.join(self._layout_tests_root, path), dirs_to_skip=['script-tests', 'resources'],
file_filter=Port.is_test_file):
- expectations = expectations.union(self._get_expectations_for_test(model, self._filesystem.relpath(test, self._layout_tests_root)))
+ expectations = expectations.union(
+ self._get_expectations_for_test(
+ model,
+ self._filesystem.relpath(
+ test,
+ self._layout_tests_root)))
return expectations
@staticmethod
@@ -211,7 +217,7 @@ class LayoutTestsMover(object):
# bar/ is moved to baz/, because the reference is always normalized to 'script.js'.
absolute_reference = self._filesystem.normpath(self._filesystem.join(root, reference))
if self._is_child_path(self._absolute_origin, root) == self._is_child_path(self._absolute_origin, absolute_reference):
- return None;
+ return None
new_root = self._move_path(root, self._absolute_origin, self._absolute_destination)
new_absolute_reference = self._move_path(absolute_reference, self._absolute_origin, self._absolute_destination)
@@ -253,7 +259,8 @@ class LayoutTestsMover(object):
def is_test_source_file(filesystem, dirname, basename):
pass_regex = re.compile(r'\.(css|js)$')
fail_regex = re.compile(r'-expected\.')
- return (Port.is_test_file(filesystem, dirname, basename) or pass_regex.search(basename)) and not fail_regex.search(basename)
+ return (Port.is_test_file(filesystem, dirname, basename)
+ or pass_regex.search(basename)) and not fail_regex.search(basename)
test_source_files = self._filesystem.files_under(self._layout_tests_root, file_filter=is_test_source_file)
_log.info('Considering %s test source files for references' % len(test_source_files))
@@ -291,7 +298,7 @@ class LayoutTestsMover(object):
self._move_directory(self._origin, self._destination)
for directory in self._filesystem.listdir(self._filesystem.join(self._layout_tests_root, PLATFORM_DIRECTORY)):
self._move_directory(self._filesystem.join(PLATFORM_DIRECTORY, directory, self._origin),
- self._filesystem.join(PLATFORM_DIRECTORY, directory, self._destination))
+ self._filesystem.join(PLATFORM_DIRECTORY, directory, self._destination))
def _commit_changes(self):
if not self._scm.supports_local_commits():
@@ -313,6 +320,7 @@ class LayoutTestsMover(object):
# FIXME: Handle virtual test suites.
self._commit_changes()
+
def main(argv):
parser = optparse.OptionParser(description=__doc__)
parser.add_option('--origin',

Powered by Google App Engine
This is Rietveld 408576698