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

Unified Diff: third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.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/models/test_expectations_unittest.py
diff --git a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
index b60ee8b589c9202a06cf905dd11082f397c745fa..54b6cd58f11cd57f678b1fc6ae89a631906bbd41 100644
--- a/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
+++ b/third_party/WebKit/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
@@ -52,17 +52,11 @@ class Base(unittest.TestCase):
unittest.TestCase.__init__(self, testFunc)
def get_basic_tests(self):
- return ['failures/expected/text.html',
- 'failures/expected/image_checksum.html',
- 'failures/expected/crash.html',
- 'failures/expected/needsrebaseline.html',
- 'failures/expected/needsmanualrebaseline.html',
- 'failures/expected/missing_text.html',
- 'failures/expected/image.html',
- 'failures/expected/timeout.html',
+ return ['failures/expected/text.html', 'failures/expected/image_checksum.html', 'failures/expected/crash.html',
+ 'failures/expected/needsrebaseline.html', 'failures/expected/needsmanualrebaseline.html',
+ 'failures/expected/missing_text.html', 'failures/expected/image.html', 'failures/expected/timeout.html',
'passes/text.html']
-
def get_basic_expectations(self):
return """
Bug(test) failures/expected/text.html [ Failure ]
@@ -81,7 +75,10 @@ Bug(test) failures/expected/image.html [ Crash Mac ]
expectations_dict['overrides'] = overrides
self._port.expectations_dict = lambda: expectations_dict
expectations_to_lint = expectations_dict if is_lint_mode else None
- self._exp = TestExpectations(self._port, self.get_basic_tests(), expectations_dict=expectations_to_lint, is_lint_mode=is_lint_mode)
+ self._exp = TestExpectations(self._port,
+ self.get_basic_tests(),
+ expectations_dict=expectations_to_lint,
+ is_lint_mode=is_lint_mode)
def assert_exp_list(self, test, results):
self.assertEqual(self._exp.get_expectations(test), set(results))
@@ -139,7 +136,9 @@ class MiscTests(Base):
self.assertTrue(TestExpectations.result_was_expected(MISSING, set([NEEDS_REBASELINE]), test_needs_rebaselining=False))
self.assertTrue(TestExpectations.result_was_expected(TEXT, set([NEEDS_REBASELINE]), test_needs_rebaselining=False))
self.assertTrue(TestExpectations.result_was_expected(IMAGE, set([NEEDS_REBASELINE]), test_needs_rebaselining=False))
- self.assertTrue(TestExpectations.result_was_expected(IMAGE_PLUS_TEXT, set([NEEDS_REBASELINE]), test_needs_rebaselining=False))
+ self.assertTrue(TestExpectations.result_was_expected(IMAGE_PLUS_TEXT,
+ set([NEEDS_REBASELINE]),
+ test_needs_rebaselining=False))
self.assertTrue(TestExpectations.result_was_expected(AUDIO, set([NEEDS_REBASELINE]), test_needs_rebaselining=False))
self.assertFalse(TestExpectations.result_was_expected(TIMEOUT, set([NEEDS_REBASELINE]), test_needs_rebaselining=False))
self.assertFalse(TestExpectations.result_was_expected(CRASH, set([NEEDS_REBASELINE]), test_needs_rebaselining=False))
@@ -166,8 +165,7 @@ class MiscTests(Base):
self.parse_exp(exp_str)
test_name = 'failures/expected/unknown-test.html'
unknown_test = test_name
- self.assertRaises(KeyError, self._exp.get_expectations,
- unknown_test)
+ self.assertRaises(KeyError, self._exp.get_expectations, unknown_test)
self.assert_exp_list('failures/expected/crash.html', [PASS])
def test_get_expectations_string(self):
@@ -177,8 +175,7 @@ class MiscTests(Base):
def test_expectation_to_string(self):
# Normal cases are handled by other tests.
self.parse_exp(self.get_basic_expectations())
- self.assertRaises(ValueError, self._exp.expectation_to_string,
- -1)
+ self.assertRaises(ValueError, self._exp.expectation_to_string, -1)
def test_get_test_set(self):
# Handle some corner cases for this routine not covered by other tests.
@@ -189,16 +186,22 @@ class MiscTests(Base):
def test_needs_rebaseline_reftest(self):
try:
filesystem = self._port.host.filesystem
- filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsrebaseline.html'), 'content')
- filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsrebaseline-expected.html'), 'content')
- filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsmanualrebaseline.html'), 'content')
- filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsmanualrebaseline-expected.html'), 'content')
+ filesystem.write_text_file(
+ filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsrebaseline.html'), 'content')
+ filesystem.write_text_file(
+ filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsrebaseline-expected.html'), 'content')
+ filesystem.write_text_file(
+ filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsmanualrebaseline.html'), 'content')
+ filesystem.write_text_file(
+ filesystem.join(self._port.layout_tests_dir(), 'failures/expected/needsmanualrebaseline-expected.html'), 'content')
self.parse_exp("""Bug(user) failures/expected/needsrebaseline.html [ NeedsRebaseline ]
-Bug(user) failures/expected/needsmanualrebaseline.html [ NeedsManualRebaseline ]""", is_lint_mode=True)
+Bug(user) failures/expected/needsmanualrebaseline.html [ NeedsManualRebaseline ]""",
+ is_lint_mode=True)
self.assertFalse(True, "ParseError wasn't raised")
except ParseError, e:
warnings = """expectations:1 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseline failures/expected/needsrebaseline.html
expectations:2 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseline failures/expected/needsmanualrebaseline.html"""
+
self.assertEqual(str(e), warnings)
def test_parse_warning(self):
@@ -210,7 +213,8 @@ expectations:2 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseli
self.parse_exp("Bug(user) [ FOO ] failures/expected/text.html [ Failure ]\n"
"Bug(user) non-existent-test.html [ Failure ]\n"
"Bug(user) disabled-test.html-disabled [ Failure ]\n"
- "Bug(user) [ Release ] test-to-rebaseline.html [ NeedsRebaseline ]", is_lint_mode=True)
+ "Bug(user) [ Release ] test-to-rebaseline.html [ NeedsRebaseline ]",
+ is_lint_mode=True)
self.assertFalse(True, "ParseError wasn't raised")
except ParseError, e:
warnings = ("expectations:1 Unrecognized specifier 'foo' failures/expected/text.html\n"
@@ -229,24 +233,26 @@ expectations:2 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseli
def test_error_on_different_platform(self):
# parse_exp uses a Windows port. Assert errors on Mac show up in lint mode.
- self.assertRaises(ParseError, self.parse_exp,
+ self.assertRaises(
+ ParseError,
+ self.parse_exp,
'Bug(test) [ Mac ] failures/expected/text.html [ Failure ]\nBug(test) [ Mac ] failures/expected/text.html [ Failure ]',
is_lint_mode=True)
def test_error_on_different_build_type(self):
# parse_exp uses a Release port. Assert errors on DEBUG show up in lint mode.
- self.assertRaises(ParseError, self.parse_exp,
+ self.assertRaises(
+ ParseError,
+ self.parse_exp,
'Bug(test) [ Debug ] failures/expected/text.html [ Failure ]\nBug(test) [ Debug ] failures/expected/text.html [ Failure ]',
is_lint_mode=True)
def test_overrides(self):
- self.parse_exp("Bug(exp) failures/expected/text.html [ Failure ]",
- "Bug(override) failures/expected/text.html [ Timeout ]")
+ self.parse_exp("Bug(exp) failures/expected/text.html [ Failure ]", "Bug(override) failures/expected/text.html [ Timeout ]")
self.assert_exp_list('failures/expected/text.html', [FAIL, TIMEOUT])
def test_overrides__directory(self):
- self.parse_exp("Bug(exp) failures/expected/text.html [ Failure ]",
- "Bug(override) failures/expected [ Crash ]")
+ self.parse_exp("Bug(exp) failures/expected/text.html [ Failure ]", "Bug(override) failures/expected [ Crash ]")
self.assert_exp_list('failures/expected/text.html', [FAIL, CRASH])
self.assert_exp_list('failures/expected/image.html', [CRASH])
@@ -257,8 +263,7 @@ expectations:2 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseli
def test_pixel_tests_flag(self):
def match(test, result, pixel_tests_enabled):
- return self._exp.matches_an_expected_result(
- test, result, pixel_tests_enabled, sanitizer_is_enabled=False)
+ return self._exp.matches_an_expected_result(test, result, pixel_tests_enabled, sanitizer_is_enabled=False)
self.parse_exp(self.get_basic_expectations())
self.assertTrue(match('failures/expected/text.html', FAIL, True))
@@ -276,8 +281,7 @@ expectations:2 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseli
def test_sanitizer_flag(self):
def match(test, result):
- return self._exp.matches_an_expected_result(
- test, result, pixel_tests_are_enabled=False, sanitizer_is_enabled=True)
+ return self._exp.matches_an_expected_result(test, result, pixel_tests_are_enabled=False, sanitizer_is_enabled=True)
self.parse_exp("""
Bug(test) failures/expected/crash.html [ Crash ]
@@ -291,11 +295,9 @@ Bug(test) failures/expected/timeout.html [ Timeout ]
self.assertTrue(match('failures/expected/timeout.html', TIMEOUT))
def test_more_specific_override_resets_skip(self):
- self.parse_exp("Bug(x) failures/expected [ Skip ]\n"
- "Bug(x) failures/expected/text.html [ Failure ]\n")
+ self.parse_exp("Bug(x) failures/expected [ Skip ]\n" "Bug(x) failures/expected/text.html [ Failure ]\n")
self.assert_exp('failures/expected/text.html', FAIL)
- self.assertFalse(self._port._filesystem.join(self._port.layout_tests_dir(),
- 'failures/expected/text.html') in
+ self.assertFalse(self._port._filesystem.join(self._port.layout_tests_dir(), 'failures/expected/text.html') in
self._exp.get_tests_with_result_type(SKIP))
def test_bot_test_expectations(self):
@@ -313,6 +315,7 @@ Bug(test) failures/expected/timeout.html [ Timeout ]
def bot_expectations():
return {test_name1: ['PASS', 'TIMEOUT'], test_name2: ['CRASH']}
+
self._port.bot_expectations = bot_expectations
self._port._options.ignore_flaky_tests = 'unexpected'
@@ -320,6 +323,7 @@ Bug(test) failures/expected/timeout.html [ Timeout ]
self.assertEqual(expectations.get_expectations(test_name1), set([PASS, FAIL, TIMEOUT]))
self.assertEqual(expectations.get_expectations(test_name2), set([CRASH]))
+
class SkippedTests(Base):
def check(self, expectations, overrides, skips, lint=False, expected_results=[WONTFIX, SKIP, FAIL]):
port = MockHost().port_factory.get('test-win-win7')
@@ -338,24 +342,28 @@ class SkippedTests(Base):
self.check(expectations='', overrides=None, skips=['failures/expected/text.html'], expected_results=[WONTFIX, SKIP])
def test_duplicate_skipped_test_fails_lint(self):
- self.assertRaises(ParseError, self.check, expectations='Bug(x) failures/expected/text.html [ Failure ]\n',
- overrides=None, skips=['failures/expected/text.html'], lint=True)
+ self.assertRaises(ParseError,
+ self.check,
+ expectations='Bug(x) failures/expected/text.html [ Failure ]\n',
+ overrides=None,
+ skips=['failures/expected/text.html'],
+ lint=True)
def test_skipped_file_overrides_expectations(self):
- self.check(expectations='Bug(x) failures/expected/text.html [ Failure ]\n', overrides=None,
+ self.check(expectations='Bug(x) failures/expected/text.html [ Failure ]\n',
+ overrides=None,
skips=['failures/expected/text.html'])
def test_skipped_dir_overrides_expectations(self):
- self.check(expectations='Bug(x) failures/expected/text.html [ Failure ]\n', overrides=None,
- skips=['failures/expected'])
+ self.check(expectations='Bug(x) failures/expected/text.html [ Failure ]\n', overrides=None, skips=['failures/expected'])
def test_skipped_file_overrides_overrides(self):
- self.check(expectations='', overrides='Bug(x) failures/expected/text.html [ Failure ]\n',
+ self.check(expectations='',
+ overrides='Bug(x) failures/expected/text.html [ Failure ]\n',
skips=['failures/expected/text.html'])
def test_skipped_dir_overrides_overrides(self):
- self.check(expectations='', overrides='Bug(x) failures/expected/text.html [ Failure ]\n',
- skips=['failures/expected'])
+ self.check(expectations='', overrides='Bug(x) failures/expected/text.html [ Failure ]\n', skips=['failures/expected'])
def test_skipped_entry_dont_exist(self):
port = MockHost().port_factory.get('test-win-win7')
@@ -385,7 +393,15 @@ class ExpectationSyntaxTests(Base):
self.parse_exp(exp_str)
self.assert_exp('failures/expected/text.html', FAIL)
- def assert_tokenize_exp(self, line, bugs=None, specifiers=None, expectations=None, warnings=None, comment=None, name='foo.html', filename='TestExpectations'):
+ def assert_tokenize_exp(self,
+ line,
+ bugs=None,
+ specifiers=None,
+ expectations=None,
+ warnings=None,
+ comment=None,
+ name='foo.html',
+ filename='TestExpectations'):
bugs = bugs or []
specifiers = specifiers or []
expectations = expectations or []
@@ -417,15 +433,41 @@ class ExpectationSyntaxTests(Base):
self.assert_tokenize_exp('foo.html [ Skip ]', specifiers=[], expectations=['SKIP'])
def test_slow(self):
- self.assert_tokenize_exp('foo.html [ Slow ]', specifiers=[], expectations=['SLOW'], warnings=['SLOW tests should ony be added to SlowTests and not to TestExpectations.'])
+ self.assert_tokenize_exp('foo.html [ Slow ]',
+ specifiers=[],
+ expectations=['SLOW'],
+ warnings=['SLOW tests should ony be added to SlowTests and not to TestExpectations.'])
self.assert_tokenize_exp('foo.html [ Slow ]', specifiers=[], expectations=['SLOW'], filename='SlowTests')
- self.assert_tokenize_exp('foo.html [ Timeout Slow ]', specifiers=[], expectations=['SKIP', 'TIMEOUT'], warnings=['Only SLOW expectations are allowed in SlowTests'], filename='SlowTests')
+ self.assert_tokenize_exp('foo.html [ Timeout Slow ]',
+ specifiers=[],
+ expectations=['SKIP', 'TIMEOUT'],
+ warnings=['Only SLOW expectations are allowed in SlowTests'],
+ filename='SlowTests')
def test_wontfix(self):
- self.assert_tokenize_exp('foo.html [ WontFix ]', specifiers=[], expectations=['WONTFIX', 'SKIP'], warnings=['WONTFIX tests should ony be added to NeverFixTests or StaleTestExpectations and not to TestExpectations.'])
- self.assert_tokenize_exp('foo.html [ WontFix Failure ]', specifiers=[], expectations=['WONTFIX', 'SKIP'], warnings=['A test marked Skip or WontFix must not have other expectations.', 'WONTFIX tests should ony be added to NeverFixTests or StaleTestExpectations and not to TestExpectations.'])
- self.assert_tokenize_exp('foo.html [ WontFix Failure ]', specifiers=[], expectations=['WONTFIX', 'SKIP'], warnings=['A test marked Skip or WontFix must not have other expectations.', 'Only WONTFIX expectations are allowed in NeverFixTests'], filename='NeverFixTests')
- self.assert_tokenize_exp('foo.html [ WontFix Timeout ]', specifiers=[], expectations=['WONTFIX', 'TIMEOUT'], warnings=['A test marked Skip or WontFix must not have other expectations.', 'Only WONTFIX expectations are allowed in NeverFixTests'], filename='NeverFixTests')
+ self.assert_tokenize_exp(
+ 'foo.html [ WontFix ]',
+ specifiers=[],
+ expectations=['WONTFIX', 'SKIP'],
+ warnings=['WONTFIX tests should ony be added to NeverFixTests or StaleTestExpectations and not to TestExpectations.'])
+ self.assert_tokenize_exp(
+ 'foo.html [ WontFix Failure ]',
+ specifiers=[],
+ expectations=['WONTFIX', 'SKIP'],
+ warnings=['A test marked Skip or WontFix must not have other expectations.',
+ 'WONTFIX tests should ony be added to NeverFixTests or StaleTestExpectations and not to TestExpectations.'])
+ self.assert_tokenize_exp('foo.html [ WontFix Failure ]',
+ specifiers=[],
+ expectations=['WONTFIX', 'SKIP'],
+ warnings=['A test marked Skip or WontFix must not have other expectations.',
+ 'Only WONTFIX expectations are allowed in NeverFixTests'],
+ filename='NeverFixTests')
+ self.assert_tokenize_exp('foo.html [ WontFix Timeout ]',
+ specifiers=[],
+ expectations=['WONTFIX', 'TIMEOUT'],
+ warnings=['A test marked Skip or WontFix must not have other expectations.',
+ 'Only WONTFIX expectations are allowed in NeverFixTests'],
+ filename='NeverFixTests')
def test_blank_line(self):
self.assert_tokenize_exp('', name=None)
@@ -435,7 +477,8 @@ class ExpectationSyntaxTests(Base):
self.assert_tokenize_exp('[ [', warnings=['unexpected "["', 'Missing expectations.'], name=None)
self.assert_tokenize_exp('crbug.com/12345 ]', warnings=['unexpected "]"', 'Missing expectations.'], name=None)
- self.assert_tokenize_exp('foo.html crbug.com/12345 ]', warnings=['"crbug.com/12345" is not at the start of the line.', 'Missing expectations.'])
+ self.assert_tokenize_exp('foo.html crbug.com/12345 ]',
+ warnings=['"crbug.com/12345" is not at the start of the line.', 'Missing expectations.'])
self.assert_tokenize_exp('foo.html', warnings=['Missing expectations.'])
@@ -473,19 +516,26 @@ class SemanticTests(Base):
def test_rebaseline(self):
# Can't lint a file w/ 'REBASELINE' in it.
- self.assertRaises(ParseError, self.parse_exp,
- 'Bug(test) failures/expected/text.html [ Failure Rebaseline ]',
- is_lint_mode=True)
+ self.assertRaises(ParseError,
+ self.parse_exp,
+ 'Bug(test) failures/expected/text.html [ Failure Rebaseline ]',
+ is_lint_mode=True)
def test_duplicates(self):
- self.assertRaises(ParseError, self.parse_exp, """
+ self.assertRaises(ParseError,
+ self.parse_exp,
+ """
Bug(exp) failures/expected/text.html [ Failure ]
-Bug(exp) failures/expected/text.html [ Timeout ]""", is_lint_mode=True)
+Bug(exp) failures/expected/text.html [ Timeout ]""",
+ is_lint_mode=True)
- self.assertRaises(ParseError, self.parse_exp,
- self.get_basic_expectations(), overrides="""
+ self.assertRaises(ParseError,
+ self.parse_exp,
+ self.get_basic_expectations(),
+ overrides="""
Bug(override) failures/expected/text.html [ Failure ]
-Bug(override) failures/expected/text.html [ Timeout ]""", is_lint_mode=True)
+Bug(override) failures/expected/text.html [ Timeout ]""",
+ is_lint_mode=True)
def test_duplicate_with_line_before_preceding_line(self):
self.assert_bad_expectations("""Bug(exp) [ Debug ] failures/expected/text.html [ Failure ]
@@ -506,6 +556,7 @@ class PrecedenceTests(Base):
Bug(x) failures/expected/text.html [ Failure ]
Bug(y) failures/expected [ Crash ]
"""
+
self.parse_exp(exp_str)
self.assert_exp('failures/expected/text.html', FAIL)
self.assert_exp_list('failures/expected/crash.html', [CRASH])
@@ -514,6 +565,7 @@ Bug(y) failures/expected [ Crash ]
Bug(x) failures/expected [ Crash ]
Bug(y) failures/expected/text.html [ Failure ]
"""
+
self.parse_exp(exp_str)
self.assert_exp('failures/expected/text.html', FAIL)
self.assert_exp_list('failures/expected/crash.html', [CRASH])
@@ -606,7 +658,8 @@ Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ]
expectations = TestExpectations(test_port)
actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', test_config)])
- actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get('test-win-win10', None).test_configuration())])
+ actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get(
+ 'test-win-win10', None).test_configuration())])
self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
""", actual_expectations)
@@ -627,7 +680,8 @@ Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
expectations = TestExpectations(test_port)
actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', test_config)])
- actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get('test-win-win10', None).test_configuration())])
+ actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get(
+ 'test-win-win10', None).test_configuration())])
self.assertEqual("""
Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
@@ -648,7 +702,8 @@ Bug(x) [ Win Release ] failures/expected/foo.html [ Failure ]"""}
expectations = TestExpectations(test_port)
actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', test_config)])
- actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get('test-win-win10', None).test_configuration())])
+ actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get(
+ 'test-win-win10', None).test_configuration())])
self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]""", actual_expectations)
@@ -667,7 +722,8 @@ Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
expectations = TestExpectations(test_port)
actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', test_config)])
- actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get('test-win-win10', None).test_configuration())])
+ actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get(
+ 'test-win-win10', None).test_configuration())])
self.assertEqual("""
# This comment line should not get stripped.
@@ -690,7 +746,8 @@ Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
expectations = TestExpectations(test_port)
actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', test_config)])
- actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get('test-win-win10', None).test_configuration())])
+ actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get(
+ 'test-win-win10', None).test_configuration())])
self.assertEqual(""" # This comment line should not get stripped.
Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
@@ -710,7 +767,8 @@ Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
expectations = TestExpectations(test_port)
actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', test_config)])
- actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get('test-win-win10', None).test_configuration())])
+ actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get(
+ 'test-win-win10', None).test_configuration())])
self.assertEqual(""" # This comment line should not get stripped.
Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
@@ -729,7 +787,8 @@ Bug(y) [ Mac ] failures/expected/foo.html [ Crash ]
expectations = TestExpectations(test_port)
actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', test_config)])
- actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get('test-win-win10', None).test_configuration())])
+ actual_expectations = expectations.remove_configurations([('failures/expected/foo.html', host.port_factory.get(
+ 'test-win-win10', None).test_configuration())])
self.assertEqual("""Bug(x) [ Win Debug ] failures/expected/foo.html [ Failure Timeout ]
Bug(y) [ Mac ] failures/expected/foo.html [ Crash ]
@@ -750,7 +809,8 @@ class TestExpectationsParserTests(unittest.TestCase):
def __init__(self, testFunc):
host = MockHost()
test_port = host.port_factory.get('test-win-win7', None)
- self._converter = TestConfigurationConverter(test_port.all_test_configurations(), test_port.configuration_specifier_macros())
+ self._converter = TestConfigurationConverter(test_port.all_test_configurations(),
+ test_port.configuration_specifier_macros())
unittest.TestCase.__init__(self, testFunc)
self._parser = TestExpectationParser(host.port_factory.get('test-win-win7', None), [], is_lint_mode=False)
@@ -774,7 +834,8 @@ class TestExpectationSerializationTests(unittest.TestCase):
def __init__(self, testFunc):
host = MockHost()
test_port = host.port_factory.get('test-win-win7', None)
- self._converter = TestConfigurationConverter(test_port.all_test_configurations(), test_port.configuration_specifier_macros())
+ self._converter = TestConfigurationConverter(test_port.all_test_configurations(),
+ test_port.configuration_specifier_macros())
unittest.TestCase.__init__(self, testFunc)
def _tokenize(self, line):
@@ -832,8 +893,10 @@ class TestExpectationSerializationTests(unittest.TestCase):
expectation_line.parsed_expectations = set([IMAGE])
self.assertEqual(expectation_line.to_string(self._converter), None)
expectation_line.matching_configurations = set([TestConfiguration('win7', 'x86', 'release')])
- self.assertEqual(expectation_line.to_string(self._converter), 'Bug(x) [ Win7 Release ] test/name/for/realz.html [ Failure ]')
- expectation_line.matching_configurations = set([TestConfiguration('win7', 'x86', 'release'), TestConfiguration('win7', 'x86', 'debug')])
+ self.assertEqual(
+ expectation_line.to_string(self._converter), 'Bug(x) [ Win7 Release ] test/name/for/realz.html [ Failure ]')
+ expectation_line.matching_configurations = set([TestConfiguration('win7', 'x86', 'release'), TestConfiguration(
+ 'win7', 'x86', 'debug')])
self.assertEqual(expectation_line.to_string(self._converter), 'Bug(x) [ Win7 ] test/name/for/realz.html [ Failure ]')
def test_parsed_to_string_mac_legacy_names(self):
@@ -843,12 +906,14 @@ class TestExpectationSerializationTests(unittest.TestCase):
expectation_line.parsed_expectations = set([IMAGE])
self.assertEqual(expectation_line.to_string(self._converter), None)
expectation_line.matching_configurations = set([TestConfiguration('mac10.10', 'x86', 'release')])
- self.assertEqual(expectation_line.to_string(self._converter), 'Bug(x) [ Mac10.10 Release ] test/name/for/realz.html [ Failure ]')
+ self.assertEqual(
+ expectation_line.to_string(self._converter), 'Bug(x) [ Mac10.10 Release ] test/name/for/realz.html [ Failure ]')
def test_serialize_parsed_expectations(self):
expectation_line = TestExpectationLine()
expectation_line.parsed_expectations = set([])
- parsed_expectation_to_string = dict([[parsed_expectation, expectation_string] for expectation_string, parsed_expectation in TestExpectations.EXPECTATIONS.items()])
+ parsed_expectation_to_string = dict([[parsed_expectation, expectation_string]
+ for expectation_string, parsed_expectation in TestExpectations.EXPECTATIONS.items()])
self.assertEqual(expectation_line._serialize_parsed_expectations(parsed_expectation_to_string), '')
expectation_line.parsed_expectations = set([FAIL])
self.assertEqual(expectation_line._serialize_parsed_expectations(parsed_expectation_to_string), 'fail')
@@ -869,8 +934,12 @@ class TestExpectationSerializationTests(unittest.TestCase):
self.assertEqual(expectation_line._serialize_parsed_specifiers(self._converter, ['win']), 'win')
def test_format_line(self):
- self.assertEqual(TestExpectationLine._format_line([], ['MODIFIERS'], 'name', ['EXPECTATIONS'], 'comment'), '[ MODIFIERS ] name [ EXPECTATIONS ] #comment')
- self.assertEqual(TestExpectationLine._format_line([], ['MODIFIERS'], 'name', ['EXPECTATIONS'], None), '[ MODIFIERS ] name [ EXPECTATIONS ]')
+ self.assertEqual(
+ TestExpectationLine._format_line([], ['MODIFIERS'], 'name', ['EXPECTATIONS'],
+ 'comment'), '[ MODIFIERS ] name [ EXPECTATIONS ] #comment')
+ self.assertEqual(
+ TestExpectationLine._format_line([], ['MODIFIERS'], 'name', ['EXPECTATIONS'],
+ None), '[ MODIFIERS ] name [ EXPECTATIONS ]')
def test_string_roundtrip(self):
self.assert_round_trip('')

Powered by Google App Engine
This is Rietveld 408576698