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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py

Issue 2014063002: Run format-webkit on webkitpy code (without string conversion). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/models/test_expectations.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
index 5cfa0f89a202014bf51a69f7e80bc01799e0eda3..c528eddadb8621c17bb45c2860047a51237fd850 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py
@@ -74,6 +74,7 @@ class ParseError(Exception):
class TestExpectationParser(object):
+
"""Provides parsing facilities for lines in the test_expectation.txt file."""
# FIXME: Rename these to *_KEYWORD as in MISSING_KEYWORD above, but make
@@ -175,10 +176,12 @@ class TestExpectationParser(object):
if self._port.reference_files(test):
text_expected_filename = self._port.expected_filename(test, '.txt')
if not self._port.host.filesystem.exists(text_expected_filename):
- expectation_line.warnings.append('A reftest without text expectation cannot be marked as NeedsRebaseline/NeedsManualRebaseline')
+ expectation_line.warnings.append(
+ 'A reftest without text expectation cannot be marked as NeedsRebaseline/NeedsManualRebaseline')
specifiers = [specifier.lower() for specifier in expectation_line.specifiers]
- if (self.REBASELINE_MODIFIER in expectations or self.NEEDS_REBASELINE_MODIFIER in expectations) and ('debug' in specifiers or 'release' in specifiers):
+ if (self.REBASELINE_MODIFIER in expectations or self.NEEDS_REBASELINE_MODIFIER in expectations) and (
+ 'debug' in specifiers or 'release' in specifiers):
expectation_line.warnings.append('A test cannot be rebaselined for Debug/Release.')
def _parse_expectations(self, expectation_line):
@@ -295,9 +298,9 @@ class TestExpectationParser(object):
state = 'start'
for token in tokens:
if (token.startswith(WEBKIT_BUG_PREFIX) or
- token.startswith(CHROMIUM_BUG_PREFIX) or
- token.startswith(V8_BUG_PREFIX) or
- token.startswith(NAMED_BUG_PREFIX)):
+ token.startswith(CHROMIUM_BUG_PREFIX) or
+ token.startswith(V8_BUG_PREFIX) or
+ token.startswith(NAMED_BUG_PREFIX)):
if state != 'start':
warnings.append('"%s" is not at the start of the line.' % token)
break
@@ -364,7 +367,8 @@ class TestExpectationParser(object):
warnings.append('SLOW tests should ony be added to SlowTests and not to TestExpectations.')
if 'WONTFIX' in expectations and ('NeverFixTests' not in filename and 'StaleTestExpectations' not in filename):
- warnings.append('WONTFIX tests should ony be added to NeverFixTests or StaleTestExpectations and not to TestExpectations.')
+ warnings.append(
+ 'WONTFIX tests should ony be added to NeverFixTests or StaleTestExpectations and not to TestExpectations.')
if 'NeverFixTests' in filename and expectations != ['WONTFIX', 'SKIP']:
warnings.append('Only WONTFIX expectations are allowed in NeverFixTests')
@@ -389,6 +393,7 @@ class TestExpectationParser(object):
class TestExpectationLine(object):
+
"""Represents a line in test expectations file."""
def __init__(self):
@@ -410,7 +415,8 @@ class TestExpectationLine(object):
self.is_skipped_outside_expectations_file = False
def __str__(self):
- return "TestExpectationLine{name=%s, matching_configurations=%s, original_string=%s}" % (self.name, self.matching_configurations, self.original_string)
+ return "TestExpectationLine{name=%s, matching_configurations=%s, original_string=%s}" % (
+ self.name, self.matching_configurations, self.original_string)
def __eq__(self, other):
return (self.original_string == other.original_string
@@ -527,7 +533,8 @@ class TestExpectationLine(object):
return expectations
@staticmethod
- def _format_line(bugs, specifiers, name, expectations, comment, include_specifiers=True, include_expectations=True, include_comment=True):
+ def _format_line(bugs, specifiers, name, expectations, comment, include_specifiers=True,
+ include_expectations=True, include_comment=True):
new_specifiers = []
new_expectations = []
for specifier in specifiers:
@@ -556,6 +563,7 @@ class TestExpectationLine(object):
# FIXME: Refactor API to be a proper CRUD.
class TestExpectationsModel(object):
+
"""Represents relational store of all expectations and provides CRUD semantics to manage it."""
def __init__(self, shorten_filename=None):
@@ -819,6 +827,7 @@ class TestExpectationsModel(object):
class TestExpectations(object):
+
"""Test expectations consist of lines with specifications of what
to expect from layout test cases. The test cases can be directories
in which case the expectations apply to all test cases in that
@@ -910,7 +919,8 @@ class TestExpectations(object):
if result in expected_results:
return True
- if result in (PASS, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, MISSING) and (NEEDS_REBASELINE in expected_results or NEEDS_MANUAL_REBASELINE in expected_results):
+ if result in (PASS, TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO, MISSING) and (
+ NEEDS_REBASELINE in expected_results or NEEDS_MANUAL_REBASELINE in expected_results):
return True
if result in (TEXT, IMAGE, IMAGE_PLUS_TEXT, AUDIO) and (FAIL in expected_results):
return True
@@ -976,7 +986,8 @@ class TestExpectations(object):
# FIXME: This constructor does too much work. We should move the actual parsing of
# the expectations into separate routines so that linting and handling overrides
# can be controlled separately, and the constructor can be more of a no-op.
- def __init__(self, port, tests=None, include_overrides=True, expectations_dict=None, model_all_expectations=False, is_lint_mode=False):
+ def __init__(self, port, tests=None, include_overrides=True, expectations_dict=None,
+ model_all_expectations=False, is_lint_mode=False):
self._full_test_list = tests
self._test_config = port.test_configuration()
self._is_lint_mode = is_lint_mode

Powered by Google App Engine
This is Rietveld 408576698