| Index: Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
|
| diff --git a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
|
| index 5971a284c5e4a19de2a47b11e5cfc670be530710..d5abd7f953793669cad3ab8097f226e93c723840 100644
|
| --- a/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
|
| +++ b/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
|
| @@ -66,7 +66,6 @@ class Base(unittest.TestCase):
|
| self.get_test('failures/expected/timeout.html'),
|
| self.get_test('passes/text.html')]
|
|
|
| -
|
| def get_basic_expectations(self):
|
| return """
|
| Bug(test) failures/expected/text.html [ Failure ]
|
| @@ -85,7 +84,11 @@ Bug(test) failures/expected/image.html [ WontFix 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(self.get_test(test)), set(results))
|
| @@ -98,6 +101,7 @@ Bug(test) failures/expected/image.html [ WontFix Mac ]
|
|
|
|
|
| class BasicTests(Base):
|
| +
|
| def test_basic(self):
|
| self.parse_exp(self.get_basic_expectations())
|
| self.assert_exp('failures/expected/text.html', FAIL)
|
| @@ -107,6 +111,7 @@ class BasicTests(Base):
|
|
|
|
|
| class MiscTests(Base):
|
| +
|
| def test_multiple_results(self):
|
| self.parse_exp('Bug(x) failures/expected/text.html [ Crash Failure ]')
|
| self.assertEqual(self._exp.get_expectations(
|
| @@ -130,7 +135,10 @@ 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))
|
| @@ -164,8 +172,8 @@ class MiscTests(Base):
|
| def test_get_expectations_string(self):
|
| self.parse_exp(self.get_basic_expectations())
|
| self.assertEqual(self._exp.get_expectations_string(
|
| - self.get_test('failures/expected/text.html')),
|
| - 'FAIL')
|
| + self.get_test('failures/expected/text.html')),
|
| + 'FAIL')
|
|
|
| def test_expectation_to_string(self):
|
| # Normal cases are handled by other tests.
|
| @@ -178,20 +186,36 @@ class MiscTests(Base):
|
| self.parse_exp(self.get_basic_expectations())
|
| s = self._exp.get_test_set(WONTFIX)
|
| self.assertEqual(s,
|
| - set([self.get_test('failures/expected/crash.html'),
|
| - self.get_test('failures/expected/image_checksum.html')]))
|
| + set([self.get_test('failures/expected/crash.html'),
|
| + self.get_test('failures/expected/image_checksum.html')]))
|
|
|
| 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)
|
| self.assertFalse(True, "ParseError wasn't raised")
|
| - except ParseError, e:
|
| + except ParseError as 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)
|
| @@ -201,13 +225,13 @@ expectations:2 A reftest cannot be marked as NeedsRebaseline/NeedsManualRebaseli
|
| filesystem = self._port.host.filesystem
|
| filesystem.write_text_file(filesystem.join(self._port.layout_tests_dir(), 'disabled-test.html-disabled'), 'content')
|
| self.get_test('disabled-test.html-disabled'),
|
| - 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 [ ImageOnlyFailure ]", is_lint_mode=True)
|
| + 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 [ ImageOnlyFailure ]', is_lint_mode=True)
|
| self.assertFalse(True, "ParseError wasn't raised")
|
| - except ParseError, e:
|
| + except ParseError as e:
|
| warnings = ("expectations:1 Unrecognized specifier 'foo' failures/expected/text.html\n"
|
| - "expectations:2 Path does not exist. non-existent-test.html")
|
| + 'expectations:2 Path does not exist. non-existent-test.html')
|
| self.assertEqual(str(e), warnings)
|
|
|
| def test_parse_warnings_are_logged_if_not_in_lint_mode(self):
|
| @@ -222,30 +246,30 @@ 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,
|
| - 'Bug(test) [ Mac ] failures/expected/text.html [ Failure ]\nBug(test) [ Mac ] failures/expected/text.html [ Failure ]',
|
| - is_lint_mode=True)
|
| + '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,
|
| - 'Bug(test) [ Debug ] failures/expected/text.html [ Failure ]\nBug(test) [ Debug ] failures/expected/text.html [ Failure ]',
|
| - is_lint_mode=True)
|
| + '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 [ ImageOnlyFailure ]")
|
| + self.parse_exp('Bug(exp) failures/expected/text.html [ Failure ]',
|
| + 'Bug(override) failures/expected/text.html [ ImageOnlyFailure ]')
|
| self.assert_exp_list('failures/expected/text.html', [FAIL, IMAGE])
|
|
|
| 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])
|
|
|
| def test_overrides__duplicate(self):
|
| - self.assert_bad_expectations("Bug(exp) failures/expected/text.html [ Failure ]",
|
| - "Bug(override) failures/expected/text.html [ ImageOnlyFailure ]\n"
|
| - "Bug(override) failures/expected/text.html [ Crash ]\n")
|
| + self.assert_bad_expectations('Bug(exp) failures/expected/text.html [ Failure ]',
|
| + 'Bug(override) failures/expected/text.html [ ImageOnlyFailure ]\n'
|
| + 'Bug(override) failures/expected/text.html [ Crash ]\n')
|
|
|
| def test_pixel_tests_flag(self):
|
| def match(test, result, pixel_tests_enabled):
|
| @@ -283,8 +307,8 @@ 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 [ ImageOnlyFailure ]\n")
|
| + self.parse_exp('Bug(x) failures/expected [ Skip ]\n'
|
| + 'Bug(x) failures/expected/text.html [ ImageOnlyFailure ]\n')
|
| self.assert_exp('failures/expected/text.html', IMAGE)
|
| self.assertFalse(self._port._filesystem.join(self._port.layout_tests_dir(),
|
| 'failures/expected/text.html') in
|
| @@ -296,7 +320,7 @@ Bug(test) failures/expected/timeout.html [ Timeout ]
|
| test_name2 = 'passes/text.html'
|
|
|
| expectations_dict = OrderedDict()
|
| - expectations_dict['expectations'] = "Bug(x) %s [ ImageOnlyFailure ]\nBug(x) %s [ Slow ]\n" % (test_name1, test_name2)
|
| + expectations_dict['expectations'] = 'Bug(x) %s [ ImageOnlyFailure ]\nBug(x) %s [ Slow ]\n' % (test_name1, test_name2)
|
| self._port.expectations_dict = lambda: expectations_dict
|
|
|
| expectations = TestExpectations(self._port, self.get_basic_tests())
|
| @@ -312,7 +336,9 @@ Bug(test) failures/expected/timeout.html [ Timeout ]
|
| self.assertEqual(expectations.get_expectations(self.get_test(test_name1)), set([PASS, IMAGE, TIMEOUT]))
|
| self.assertEqual(expectations.get_expectations(self.get_test(test_name2)), set([CRASH, SLOW]))
|
|
|
| +
|
| class SkippedTests(Base):
|
| +
|
| def check(self, expectations, overrides, skips, lint=False, expected_results=[WONTFIX, SKIP, FAIL]):
|
| port = MockHost().port_factory.get('test-win-xp')
|
| port._filesystem.write_text_file(port._filesystem.join(port.layout_tests_dir(), 'failures/expected/text.html'), 'foo')
|
| @@ -331,7 +357,7 @@ class SkippedTests(Base):
|
|
|
| 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)
|
| + 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,
|
| @@ -369,6 +395,7 @@ class SkippedTests(Base):
|
|
|
|
|
| class ExpectationSyntaxTests(Base):
|
| +
|
| def test_unrecognized_expectation(self):
|
| self.assert_bad_expectations('Bug(test) failures/expected/text.html [ Unknown ]')
|
|
|
| @@ -377,7 +404,8 @@ 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'):
|
| + def assert_tokenize_exp(self, line, bugs=None, specifiers=None, expectations=None,
|
| + warnings=None, comment=None, name='foo.html'):
|
| bugs = bugs or []
|
| specifiers = specifiers or []
|
| expectations = expectations or []
|
| @@ -394,8 +422,8 @@ class ExpectationSyntaxTests(Base):
|
| self.assertEqual(expectation_line.expectations, expectations)
|
|
|
| def test_comments(self):
|
| - self.assert_tokenize_exp("# comment", name=None, comment="# comment")
|
| - self.assert_tokenize_exp("foo.html [ Pass ] # comment", comment="# comment", expectations=['PASS'], specifiers=[])
|
| + self.assert_tokenize_exp('# comment', name=None, comment='# comment')
|
| + self.assert_tokenize_exp('foo.html [ Pass ] # comment', comment='# comment', expectations=['PASS'], specifiers=[])
|
|
|
| def test_config_specifiers(self):
|
| self.assert_tokenize_exp('[ Mac ] foo.html [ Failure ] ', specifiers=['MAC'], expectations=['FAIL'])
|
| @@ -415,7 +443,7 @@ class ExpectationSyntaxTests(Base):
|
| def test_wontfix(self):
|
| self.assert_tokenize_exp('foo.html [ WontFix ]', specifiers=[], expectations=['WONTFIX', 'SKIP'])
|
| self.assert_tokenize_exp('foo.html [ WontFix ImageOnlyFailure ]', specifiers=[], expectations=['WONTFIX', 'SKIP'],
|
| - warnings=['A test marked Skip or WontFix must not have other expectations.'])
|
| + warnings=['A test marked Skip or WontFix must not have other expectations.'])
|
|
|
| def test_blank_line(self):
|
| self.assert_tokenize_exp('', name=None)
|
| @@ -425,11 +453,16 @@ 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.'])
|
|
|
|
|
| class SemanticTests(Base):
|
| +
|
| def test_bug_format(self):
|
| self.assertRaises(ParseError, self.parse_exp, 'BUG1234 failures/expected/text.html [ Failure ]', is_lint_mode=True)
|
|
|
| @@ -437,7 +470,7 @@ class SemanticTests(Base):
|
| try:
|
| self.parse_exp('crbug/1234 failures/expected/text.html [ Failure ]', is_lint_mode=True)
|
| self.fail('should have raised an error about a bad bug identifier')
|
| - except ParseError, exp:
|
| + except ParseError as exp:
|
| self.assertEqual(len(exp.warnings), 3)
|
|
|
| def test_missing_bugid(self):
|
| @@ -446,7 +479,7 @@ class SemanticTests(Base):
|
|
|
| try:
|
| self.parse_exp('failures/expected/text.html [ Failure ]', is_lint_mode=True)
|
| - except ParseError, exp:
|
| + except ParseError as exp:
|
| self.assertEqual(exp.warnings, ['expectations:1 Test lacks BUG specifier. failures/expected/text.html'])
|
|
|
| def test_skip_and_wontfix(self):
|
| @@ -464,8 +497,8 @@ 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)
|
| + 'Bug(test) failures/expected/text.html [ Failure Rebaseline ]',
|
| + is_lint_mode=True)
|
|
|
| def test_duplicates(self):
|
| self.assertRaises(ParseError, self.parse_exp, """
|
| @@ -473,7 +506,7 @@ Bug(exp) failures/expected/text.html [ Failure ]
|
| Bug(exp) failures/expected/text.html [ ImageOnlyFailure ]""", is_lint_mode=True)
|
|
|
| self.assertRaises(ParseError, self.parse_exp,
|
| - self.get_basic_expectations(), overrides="""
|
| + self.get_basic_expectations(), overrides="""
|
| Bug(override) failures/expected/text.html [ Failure ]
|
| Bug(override) failures/expected/text.html [ ImageOnlyFailure ]""", is_lint_mode=True)
|
|
|
| @@ -489,6 +522,7 @@ Bug(exp) [ Debug ] failures/expected/text.html [ Failure ]
|
|
|
|
|
| class PrecedenceTests(Base):
|
| +
|
| def test_file_over_directory(self):
|
| # This tests handling precedence of specific lines over directories
|
| # and tests expectations covering entire directories.
|
| @@ -509,23 +543,24 @@ Bug(y) failures/expected/text.html [ Failure ]
|
| self.assert_exp_list('failures/expected/crash.html', [WONTFIX, SKIP])
|
|
|
| def test_ambiguous(self):
|
| - self.assert_bad_expectations("Bug(test) [ Release ] passes/text.html [ Pass ]\n"
|
| - "Bug(test) [ Win ] passes/text.html [ Failure ]\n")
|
| + self.assert_bad_expectations('Bug(test) [ Release ] passes/text.html [ Pass ]\n'
|
| + 'Bug(test) [ Win ] passes/text.html [ Failure ]\n')
|
|
|
| def test_more_specifiers(self):
|
| - self.assert_bad_expectations("Bug(test) [ Release ] passes/text.html [ Pass ]\n"
|
| - "Bug(test) [ Win Release ] passes/text.html [ Failure ]\n")
|
| + self.assert_bad_expectations('Bug(test) [ Release ] passes/text.html [ Pass ]\n'
|
| + 'Bug(test) [ Win Release ] passes/text.html [ Failure ]\n')
|
|
|
| def test_order_in_file(self):
|
| - self.assert_bad_expectations("Bug(test) [ Win Release ] : passes/text.html [ Failure ]\n"
|
| - "Bug(test) [ Release ] : passes/text.html [ Pass ]\n")
|
| + self.assert_bad_expectations('Bug(test) [ Win Release ] : passes/text.html [ Failure ]\n'
|
| + 'Bug(test) [ Release ] : passes/text.html [ Pass ]\n')
|
|
|
| def test_macro_overrides(self):
|
| - self.assert_bad_expectations("Bug(test) [ Win ] passes/text.html [ Pass ]\n"
|
| - "Bug(test) [ XP ] passes/text.html [ Failure ]\n")
|
| + self.assert_bad_expectations('Bug(test) [ Win ] passes/text.html [ Pass ]\n'
|
| + 'Bug(test) [ XP ] passes/text.html [ Failure ]\n')
|
|
|
|
|
| class RemoveConfigurationsTest(Base):
|
| +
|
| def test_remove(self):
|
| host = MockHost()
|
| test_port = host.port_factory.get('test-win-xp', None)
|
| @@ -533,7 +568,7 @@ class RemoveConfigurationsTest(Base):
|
| test_port.test_isfile = lambda test: True
|
|
|
| test_config = test_port.test_configuration()
|
| - test_port.expectations_dict = lambda: {"expectations": """Bug(x) [ Linux Win Release ] failures/expected/foo.html [ Failure ]
|
| + test_port.expectations_dict = lambda: {'expectations': """Bug(x) [ Linux Win Release ] failures/expected/foo.html [ Failure ]
|
| Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ]
|
| """}
|
| expectations = TestExpectations(test_port, self.get_basic_tests())
|
| @@ -551,7 +586,7 @@ Bug(y) [ Win Mac Debug ] failures/expected/foo.html [ Crash ]
|
| test_port.test_isfile = lambda test: True
|
|
|
| test_config = test_port.test_configuration()
|
| - test_port.expectations_dict = lambda: {"expectations": """Bug(x) [ Win ] failures/expected/foo.html [ NeedsRebaseline ]
|
| + test_port.expectations_dict = lambda: {'expectations': """Bug(x) [ Win ] failures/expected/foo.html [ NeedsRebaseline ]
|
| """}
|
| expectations = TestExpectations(test_port, self.get_basic_tests())
|
|
|
| @@ -596,7 +631,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-win7', None).test_configuration())])
|
| + actual_expectations = expectations.remove_configurations(
|
| + [('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())])
|
|
|
| self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
|
| """, actual_expectations)
|
| @@ -617,7 +653,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-win7', None).test_configuration())])
|
| + actual_expectations = expectations.remove_configurations(
|
| + [('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())])
|
|
|
| self.assertEqual("""
|
| Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
|
| @@ -637,7 +674,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-win7', None).test_configuration())])
|
| + actual_expectations = expectations.remove_configurations(
|
| + [('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())])
|
|
|
| self.assertEqual("""Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]""", actual_expectations)
|
|
|
| @@ -656,7 +694,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-win7', None).test_configuration())])
|
| + actual_expectations = expectations.remove_configurations(
|
| + [('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())])
|
|
|
| self.assertEqual("""
|
| # This comment line should not get stripped.
|
| @@ -679,7 +718,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-win7', None).test_configuration())])
|
| + actual_expectations = expectations.remove_configurations(
|
| + [('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())])
|
|
|
| self.assertEqual(""" # This comment line should not get stripped.
|
| Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
|
| @@ -699,7 +739,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-win7', None).test_configuration())])
|
| + actual_expectations = expectations.remove_configurations(
|
| + [('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())])
|
|
|
| self.assertEqual(""" # This comment line should not get stripped.
|
| Bug(y) [ Win Debug ] failures/expected/foo.html [ Crash ]
|
| @@ -718,7 +759,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-win7', None).test_configuration())])
|
| + actual_expectations = expectations.remove_configurations(
|
| + [('failures/expected/foo.html', host.port_factory.get('test-win-win7', None).test_configuration())])
|
|
|
| self.assertEqual("""Bug(x) [ Win Debug ] failures/expected/foo.html [ Failure Timeout ]
|
| Bug(y) [ Mac ] failures/expected/foo.html [ Crash ]
|
| @@ -726,6 +768,7 @@ Bug(y) [ Mac ] failures/expected/foo.html [ Crash ]
|
|
|
|
|
| class RebaseliningTest(Base):
|
| +
|
| def test_get_rebaselining_failures(self):
|
| # Make sure we find a test as needing a rebaseline even if it is not marked as a failure.
|
| self.parse_exp('Bug(x) failures/expected/text.html [ Rebaseline ]\n')
|
| @@ -736,17 +779,20 @@ class RebaseliningTest(Base):
|
|
|
|
|
| class TestExpectationsParserTests(unittest.TestCase):
|
| +
|
| def __init__(self, testFunc):
|
| host = MockHost()
|
| test_port = host.port_factory.get('test-win-xp', 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-xp', None), [], is_lint_mode=False)
|
|
|
| def test_expectation_line_for_test(self):
|
| # This is kind of a silly test, but it at least ensures that we don't throw an error.
|
| test_name = 'foo/test.html'
|
| - expectations = set(["PASS", "IMAGE"])
|
| + expectations = set(['PASS', 'IMAGE'])
|
|
|
| expectation_line = TestExpectationLine()
|
| expectation_line.original_string = test_name
|
| @@ -760,10 +806,13 @@ class TestExpectationsParserTests(unittest.TestCase):
|
|
|
|
|
| class TestExpectationSerializationTests(unittest.TestCase):
|
| +
|
| def __init__(self, testFunc):
|
| host = MockHost()
|
| test_port = host.port_factory.get('test-win-xp', 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):
|
| @@ -821,14 +870,19 @@ 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('xp', 'x86', 'release')])
|
| - self.assertEqual(expectation_line.to_string(self._converter), 'Bug(x) [ XP Release ] test/name/for/realz.html [ ImageOnlyFailure ]')
|
| - expectation_line.matching_configurations = set([TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')])
|
| + self.assertEqual(
|
| + expectation_line.to_string(
|
| + self._converter),
|
| + 'Bug(x) [ XP Release ] test/name/for/realz.html [ ImageOnlyFailure ]')
|
| + expectation_line.matching_configurations = set(
|
| + [TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')])
|
| self.assertEqual(expectation_line.to_string(self._converter), 'Bug(x) [ XP ] test/name/for/realz.html [ ImageOnlyFailure ]')
|
|
|
| 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')
|
| @@ -849,8 +903,22 @@ 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('')
|
| @@ -889,7 +957,7 @@ class TestExpectationSerializationTests(unittest.TestCase):
|
|
|
| def add_line(matching_configurations, reconstitute):
|
| expectation_line = TestExpectationLine()
|
| - expectation_line.original_string = "Nay"
|
| + expectation_line.original_string = 'Nay'
|
| expectation_line.bugs = ['Bug(x)']
|
| expectation_line.name = 'Yay'
|
| expectation_line.parsed_expectations = set([IMAGE])
|
| @@ -901,9 +969,9 @@ class TestExpectationSerializationTests(unittest.TestCase):
|
| add_line(set([TestConfiguration('xp', 'x86', 'release')]), True)
|
| add_line(set([TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')]), False)
|
| serialized = TestExpectations.list_to_string(lines, self._converter)
|
| - self.assertEqual(serialized, "Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nBug(x) [ XP ] Yay [ ImageOnlyFailure ]")
|
| + self.assertEqual(serialized, 'Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nBug(x) [ XP ] Yay [ ImageOnlyFailure ]')
|
| serialized = TestExpectations.list_to_string(lines, self._converter, reconstitute_only_these=reconstitute_only_these)
|
| - self.assertEqual(serialized, "Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nNay")
|
| + self.assertEqual(serialized, 'Bug(x) [ XP Release ] Yay [ ImageOnlyFailure ]\nNay')
|
|
|
| def disabled_test_string_whitespace_stripping(self):
|
| # FIXME: Re-enable this test once we rework the code to no longer support the old syntax.
|
|
|