Diff
Modified: trunk/Tools/ChangeLog (126333 => 126334)
--- trunk/Tools/ChangeLog 2012-08-22 19:30:08 UTC (rev 126333)
+++ trunk/Tools/ChangeLog 2012-08-22 19:32:41 UTC (rev 126334)
@@ -1,3 +1,52 @@
+2012-08-21 Ryosuke Niwa <[email protected]>
+
+ Merge TestExpectationSerializer into TestExpectationLine
+ https://bugs.webkit.org/show_bug.cgi?id=94638
+
+ Reviewed by Dimitri Glazkov.
+
+ Moved all methods except, list_to_string which was moved to TestExpectations
+ from TestExpectationSerializer to TestExpectationLine and removed TestExpectationSerializer.
+
+ * Scripts/webkitpy/layout_tests/controllers/test_expectations_editor_unittest.py:
+ (TestExpectationEditorTests.assert_remove_roundtrip):
+ (TestExpectationEditorTests.assert_update_roundtrip):
+ * Scripts/webkitpy/layout_tests/models/test_expectations.py:
+ (ParseError.__repr__):
+ (TestExpectationLine):
+ (TestExpectationLine.create_passing_expectation):
+ (TestExpectationLine.to_string): Moved from TestExpectationSerializer.
+ (TestExpectationLine.to_csv): Ditto.
+ (TestExpectationLine._serialize_parsed_expectations): Ditto.
+ (TestExpectationLine._serialize_parsed_modifiers): Ditto.
+ (TestExpectationLine._format_line):
+ (TestExpectations.remove_configuration_from_test):
+ (TestExpectations.remove_rebaselined_tests):
+ (TestExpectations.add_skipped_tests):
+ (TestExpectations):
+ (TestExpectations.list_to_string): Moved from TestExpectationSerializer.
+ (TestExpectations.list_to_string.serialize):
+ (TestExpectations.list_to_string.nones_out):
+ * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py:
+ (TestExpectationSerializationTests): Renamed from TestExpectationSerializerTests.
+ (TestExpectationSerializationTests.__init__):
+ (TestExpectationSerializationTests.assert_round_trip):
+ (TestExpectationSerializationTests.assert_list_round_trip):
+ (TestExpectationSerializationTests.test_unparsed_to_string):
+ (TestExpectationSerializationTests.test_unparsed_list_to_string):
+ (TestExpectationSerializationTests.test_parsed_to_string):
+ (TestExpectationSerializationTests.test_serialize_parsed_expectations):
+ (TestExpectationSerializationTests.test_serialize_parsed_modifier_string):
+ (TestExpectationSerializationTests.test_format_line):
+ (TestExpectationSerializationTests.test_reconstitute_only_these):
+ * Scripts/webkitpy/tool/commands/expectations.py:
+ (OptimizeExpectations.execute):
+ * Scripts/webkitpy/tool/commands/queries.py:
+ (PrintExpectations.execute):
+ (PrintExpectations._format_lines):
+ * Scripts/webkitpy/tool/servers/gardeningserver.py:
+ (GardeningExpectationsUpdater.update_expectations):
+
2012-08-22 Alexandre Elias <[email protected]>
Unreviewed, add [email protected] to committers
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_expectations_editor_unittest.py (126333 => 126334)
--- trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_expectations_editor_unittest.py 2012-08-22 19:30:08 UTC (rev 126333)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/controllers/test_expectations_editor_unittest.py 2012-08-22 19:32:41 UTC (rev 126334)
@@ -88,7 +88,7 @@
editor = TestExpectationsEditor(expectation_lines, MockBugManager())
editor.remove_expectation(test, test_config_set, remove_flakes)
converter = TestConfigurationConverter(self.test_port.all_test_configurations(), self.test_port.configuration_specifier_macros())
- result = TestExpectationSerializer.list_to_string(expectation_lines, converter)
+ result = TestExpectations.list_to_string(expectation_lines, converter)
self.assertEquals(result, expected_string)
def assert_update_roundtrip(self, in_string, test, expectation_set, expected_string, expected_update_count, remove_flakes=False, parsed_bug_modifiers=None, test_configs=None):
@@ -100,7 +100,7 @@
self.assertTrue(updated_expectation_line in expectation_lines)
self.assertEquals(len(updated_expectation_lines), expected_update_count)
converter = TestConfigurationConverter(self.test_port.all_test_configurations(), self.test_port.configuration_specifier_macros())
- result = TestExpectationSerializer.list_to_string(expectation_lines, converter)
+ result = TestExpectations.list_to_string(expectation_lines, converter)
self.assertEquals(result, expected_string)
def test_remove_expectation(self):
@@ -188,35 +188,35 @@
test = "failures/expected/keyboard.html"
editor.remove_expectation(test, set([TestConfiguration('xp', 'x86', 'release')]))
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 XP DEBUG : failures/expected/keyboard.html = IMAGE
BUGX1 VISTA WIN7 : failures/expected/keyboard.html = IMAGE
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.remove_expectation(test, set([TestConfiguration('xp', 'x86', 'debug')]))
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 VISTA WIN7 : failures/expected/keyboard.html = IMAGE
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.remove_expectation(test, set([TestConfiguration('vista', 'x86', 'debug'), TestConfiguration('win7', 'x86', 'release')]))
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 VISTA RELEASE : failures/expected/keyboard.html = IMAGE
BUGX1 WIN7 DEBUG : failures/expected/keyboard.html = IMAGE
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.remove_expectation(test, set([TestConfiguration('vista', 'x86', 'debug'), TestConfiguration('vista', 'x86', 'release')]))
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 WIN7 DEBUG : failures/expected/keyboard.html = IMAGE
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.remove_expectation(test, set(self.test_port.all_test_configurations()))
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
test = "failures/expected/audio.html"
editor.remove_expectation(test, set(self.test_port.all_test_configurations()))
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), "")
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), "")
def test_update_expectation(self):
self.assert_update_roundtrip("""
@@ -306,35 +306,35 @@
test = "failures/expected/keyboard.html"
editor.update_expectation(test, set([TestConfiguration('xp', 'x86', 'release')]), set([IMAGE_PLUS_TEXT]), ['BUG_UPDATE1'])
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 XP DEBUG : failures/expected/keyboard.html = IMAGE
BUGX1 VISTA WIN7 : failures/expected/keyboard.html = IMAGE
BUG_UPDATE1 XP RELEASE : failures/expected/keyboard.html = IMAGE+TEXT
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.update_expectation(test, set([TestConfiguration('xp', 'x86', 'debug')]), set([TEXT]), ['BUG_UPDATE2'])
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 VISTA WIN7 : failures/expected/keyboard.html = IMAGE
BUG_UPDATE2 XP DEBUG : failures/expected/keyboard.html = TEXT
BUG_UPDATE1 XP RELEASE : failures/expected/keyboard.html = IMAGE+TEXT
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.update_expectation(test, self.WIN_RELEASE_CONFIGS, set([CRASH]), ['BUG_UPDATE3'])
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 VISTA WIN7 DEBUG : failures/expected/keyboard.html = IMAGE
BUG_UPDATE2 XP DEBUG : failures/expected/keyboard.html = TEXT
BUG_UPDATE3 WIN RELEASE : failures/expected/keyboard.html = CRASH
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.update_expectation(test, self.RELEASE_CONFIGS, set([IMAGE_PLUS_TEXT]), ['BUG_UPDATE4'])
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUGX1 VISTA WIN7 DEBUG : failures/expected/keyboard.html = IMAGE
BUG_UPDATE2 XP DEBUG : failures/expected/keyboard.html = TEXT
BUG_UPDATE4 RELEASE : failures/expected/keyboard.html = IMAGE+TEXT
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
editor.update_expectation(test, set(self.test_port.all_test_configurations()), set([TIMEOUT]), ['BUG_UPDATE5'])
- self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
+ self.assertEquals(TestExpectations.list_to_string(expectation_lines, converter), """
BUG_UPDATE5 : failures/expected/keyboard.html = TIMEOUT
BUGX2 WIN : failures/expected/audio.html = IMAGE""")
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py (126333 => 126334)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2012-08-22 19:30:08 UTC (rev 126333)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations.py 2012-08-22 19:32:41 UTC (rev 126334)
@@ -61,83 +61,6 @@
return 'ParseError(warnings=%s)' % self.warnings
-class TestExpectationSerializer(object):
- """Provides means of serializing TestExpectationLine instances."""
- def __init__(self, test_configuration_converter=None):
- self._test_configuration_converter = test_configuration_converter
- self._parsed_expectation_to_string = dict([[parsed_expectation, expectation_string] for expectation_string, parsed_expectation in TestExpectations.EXPECTATIONS.items()])
-
- def to_string(self, expectation_line, include_modifiers=True, include_expectations=True, include_comment=True):
- if expectation_line.is_invalid():
- return expectation_line.original_string or ''
-
- if expectation_line.name is None:
- return '' if expectation_line.comment is None else "//%s" % expectation_line.comment
-
- if self._test_configuration_converter and expectation_line.parsed_bug_modifiers:
- specifiers_list = self._test_configuration_converter.to_specifiers_list(expectation_line.matching_configurations)
- result = []
- for specifiers in specifiers_list:
- modifiers = self._parsed_modifier_string(expectation_line, specifiers)
- expectations = self._parsed_expectations_string(expectation_line)
- result.append(self._format_result(modifiers, expectation_line.name, expectations, expectation_line.comment))
- return "\n".join(result) if result else None
-
- return self._format_result(" ".join(expectation_line.modifiers),
- expectation_line.name,
- " ".join(expectation_line.expectations),
- expectation_line.comment,
- include_modifiers, include_expectations, include_comment)
-
- def to_csv(self, expectation_line):
- # Note that this doesn't include the comments.
- return '%s,%s,%s' % (expectation_line.name, ' '.join(expectation_line.modifiers), ' '.join(expectation_line.expectations))
-
- def _parsed_expectations_string(self, expectation_line):
- result = []
- for index in TestExpectations.EXPECTATION_ORDER:
- if index in expectation_line.parsed_expectations:
- result.append(self._parsed_expectation_to_string[index])
- return ' '.join(result)
-
- def _parsed_modifier_string(self, expectation_line, specifiers):
- assert(self._test_configuration_converter)
- result = []
- if expectation_line.parsed_bug_modifiers:
- result.extend(sorted(expectation_line.parsed_bug_modifiers))
- result.extend(sorted(expectation_line.parsed_modifiers))
- result.extend(self._test_configuration_converter.specifier_sorter().sort_specifiers(specifiers))
- return ' '.join(result)
-
- @classmethod
- def _format_result(cls, modifiers, name, expectations, comment, include_modifiers=True, include_expectations=True, include_comment=True):
- result = ''
- if include_modifiers:
- result += '%s : ' % modifiers.upper()
- result += name
- if include_expectations:
- result += ' = %s' % expectations.upper()
- if include_comment and comment is not None:
- result += " //%s" % comment
- return result
-
- @classmethod
- def list_to_string(cls, expectation_lines, test_configuration_converter=None, reconstitute_only_these=None):
- serializer = cls(test_configuration_converter)
-
- def serialize(expectation_line):
- # If reconstitute_only_these is an empty list, we want to return original_string.
- # So we need to compare reconstitute_only_these to None, not just check if it's falsey.
- if reconstitute_only_these is None or expectation_line in reconstitute_only_these:
- return serializer.to_string(expectation_line)
- return expectation_line.original_string
-
- def nones_out(expectation_line):
- return expectation_line is not None
-
- return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
-
-
class TestExpectationParser(object):
"""Provides parsing facilities for lines in the test_expectation.txt file."""
@@ -352,8 +275,8 @@
def is_flaky(self):
return len(self.parsed_expectations) > 1
- @classmethod
- def create_passing_expectation(cls, test):
+ @staticmethod
+ def create_passing_expectation(test):
expectation_line = TestExpectationLine()
expectation_line.name = test
expectation_line.path = test
@@ -362,7 +285,59 @@
expectation_line.matching_tests = [test]
return expectation_line
+ def to_string(self, test_configuration_converter, include_modifiers=True, include_expectations=True, include_comment=True):
+ parsed_expectation_to_string = dict([[parsed_expectation, expectation_string] for expectation_string, parsed_expectation in TestExpectations.EXPECTATIONS.items()])
+ if self.is_invalid():
+ return self.original_string or ''
+
+ if self.name is None:
+ return '' if self.comment is None else "//%s" % self.comment
+
+ if test_configuration_converter and self.parsed_bug_modifiers:
+ specifiers_list = test_configuration_converter.to_specifiers_list(self.matching_configurations)
+ result = []
+ for specifiers in specifiers_list:
+ modifiers = self._serialize_parsed_modifiers(test_configuration_converter, specifiers)
+ expectations = self._serialize_parsed_expectations(parsed_expectation_to_string)
+ result.append(self._format_line(modifiers, self.name, expectations, self.comment))
+ return "\n".join(result) if result else None
+
+ return self._format_line(" ".join(self.modifiers), self.name, " ".join(self.expectations), self.comment,
+ include_modifiers, include_expectations, include_comment)
+
+ def to_csv(self):
+ # Note that this doesn't include the comments.
+ return '%s,%s,%s' % (self.name, ' '.join(self.modifiers), ' '.join(self.expectations))
+
+ def _serialize_parsed_expectations(self, parsed_expectation_to_string):
+ result = []
+ for index in TestExpectations.EXPECTATION_ORDER:
+ if index in self.parsed_expectations:
+ result.append(parsed_expectation_to_string[index])
+ return ' '.join(result)
+
+ def _serialize_parsed_modifiers(self, test_configuration_converter, specifiers):
+ result = []
+ if self.parsed_bug_modifiers:
+ result.extend(sorted(self.parsed_bug_modifiers))
+ result.extend(sorted(self.parsed_modifiers))
+ result.extend(test_configuration_converter.specifier_sorter().sort_specifiers(specifiers))
+ return ' '.join(result)
+
+ @staticmethod
+ def _format_line(modifiers, name, expectations, comment, include_modifiers=True, include_expectations=True, include_comment=True):
+ result = ''
+ if include_modifiers:
+ result += '%s : ' % modifiers.upper()
+ result += name
+ if include_expectations:
+ result += ' = %s' % expectations.upper()
+ if include_comment and comment is not None:
+ result += " //%s" % comment
+ return result
+
+
# FIXME: Refactor API to be a proper CRUD.
class TestExpectationsModel(object):
"""Represents relational store of all expectations and provides CRUD semantics to manage it."""
@@ -842,7 +817,7 @@
for expectation in expectations_to_remove:
self._expectations.remove(expectation)
- return TestExpectationSerializer.list_to_string(self._expectations, self._parser._test_configuration_converter, modified_expectations)
+ return self.list_to_string(self._expectations, self._parser._test_configuration_converter, modified_expectations)
def remove_rebaselined_tests(self, except_these_tests, filename):
"""Returns a copy of the expectations in the file with the tests removed."""
@@ -852,7 +827,7 @@
'rebaseline' in expectation.parsed_modifiers and
filename == expectation.filename)
- return TestExpectationSerializer.list_to_string(filter(without_rebaseline_modifier, self._expectations))
+ return self.list_to_string(filter(without_rebaseline_modifier, self._expectations))
def _add_expectations(self, expectation_list):
for expectation_line in expectation_list:
@@ -872,3 +847,17 @@
for test_name in tests_to_skip:
expectation_line = self._parser.expectation_for_skipped_test(test_name)
self._model.add_expectation_line(expectation_line, in_skipped=True)
+
+ @staticmethod
+ def list_to_string(expectation_lines, test_configuration_converter=None, reconstitute_only_these=None):
+ def serialize(expectation_line):
+ # If reconstitute_only_these is an empty list, we want to return original_string.
+ # So we need to compare reconstitute_only_these to None, not just check if it's falsey.
+ if reconstitute_only_these is None or expectation_line in reconstitute_only_these:
+ return expectation_line.to_string(test_configuration_converter)
+ return expectation_line.original_string
+
+ def nones_out(expectation_line):
+ return expectation_line is not None
+
+ return "\n".join(filter(nones_out, map(serialize, expectation_lines)))
Modified: trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py (126333 => 126334)
--- trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2012-08-22 19:30:08 UTC (rev 126333)
+++ trunk/Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py 2012-08-22 19:32:41 UTC (rev 126334)
@@ -544,12 +544,11 @@
self.assertFalse(expectation_line.is_invalid())
-class TestExpectationSerializerTests(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._serializer = TestExpectationSerializer(self._converter)
unittest.TestCase.__init__(self, testFunc)
def _tokenize(self, line):
@@ -559,7 +558,7 @@
expectation = self._tokenize(in_string)
if expected_string is None:
expected_string = in_string
- self.assertEqual(expected_string, self._serializer.to_string(expectation))
+ self.assertEqual(expected_string, expectation.to_string(self._converter))
def assert_list_round_trip(self, in_string, expected_string=None):
host = MockHost()
@@ -567,29 +566,28 @@
expectations = parser.parse('path', in_string)
if expected_string is None:
expected_string = in_string
- self.assertEqual(expected_string, TestExpectationSerializer.list_to_string(expectations, self._converter))
+ self.assertEqual(expected_string, TestExpectations.list_to_string(expectations, self._converter))
def test_unparsed_to_string(self):
expectation = TestExpectationLine()
- serializer = TestExpectationSerializer()
- self.assertEqual(serializer.to_string(expectation), '')
+ self.assertEqual(expectation.to_string(self._converter), '')
expectation.comment = 'Qux.'
- self.assertEqual(serializer.to_string(expectation), '//Qux.')
+ self.assertEqual(expectation.to_string(self._converter), '//Qux.')
expectation.name = 'bar'
- self.assertEqual(serializer.to_string(expectation), ' : bar = //Qux.')
+ self.assertEqual(expectation.to_string(self._converter), ' : bar = //Qux.')
expectation.modifiers = ['foo']
- self.assertEqual(serializer.to_string(expectation), 'FOO : bar = //Qux.')
+ self.assertEqual(expectation.to_string(self._converter), 'FOO : bar = //Qux.')
expectation.expectations = ['bAz']
- self.assertEqual(serializer.to_string(expectation), 'FOO : bar = BAZ //Qux.')
+ self.assertEqual(expectation.to_string(self._converter), 'FOO : bar = BAZ //Qux.')
expectation.expectations = ['bAz1', 'baZ2']
- self.assertEqual(serializer.to_string(expectation), 'FOO : bar = BAZ1 BAZ2 //Qux.')
+ self.assertEqual(expectation.to_string(self._converter), 'FOO : bar = BAZ1 BAZ2 //Qux.')
expectation.modifiers = ['foo1', 'foO2']
- self.assertEqual(serializer.to_string(expectation), 'FOO1 FOO2 : bar = BAZ1 BAZ2 //Qux.')
+ self.assertEqual(expectation.to_string(self._converter), 'FOO1 FOO2 : bar = BAZ1 BAZ2 //Qux.')
expectation.warnings.append('Oh the horror.')
- self.assertEqual(serializer.to_string(expectation), '')
+ self.assertEqual(expectation.to_string(self._converter), '')
expectation.original_string = 'Yes it is!'
- self.assertEqual(serializer.to_string(expectation), 'Yes it is!')
+ self.assertEqual(expectation.to_string(self._converter), 'Yes it is!')
def test_unparsed_list_to_string(self):
expectation = TestExpectationLine()
@@ -597,49 +595,50 @@
expectation.name = 'bar'
expectation.modifiers = ['foo']
expectation.expectations = ['bAz1', 'baZ2']
- self.assertEqual(TestExpectationSerializer.list_to_string([expectation]), 'FOO : bar = BAZ1 BAZ2 //Qux.')
+ self.assertEqual(TestExpectations.list_to_string([expectation]), 'FOO : bar = BAZ1 BAZ2 //Qux.')
def test_parsed_to_string(self):
expectation_line = TestExpectationLine()
expectation_line.parsed_bug_modifiers = ['BUGX']
expectation_line.name = 'test/name/for/realz.html'
expectation_line.parsed_expectations = set([IMAGE])
- self.assertEqual(self._serializer.to_string(expectation_line), None)
+ self.assertEqual(expectation_line.to_string(self._converter), None)
expectation_line.matching_configurations = set([TestConfiguration('xp', 'x86', 'release')])
- self.assertEqual(self._serializer.to_string(expectation_line), 'BUGX XP RELEASE : test/name/for/realz.html = IMAGE')
+ self.assertEqual(expectation_line.to_string(self._converter), 'BUGX XP RELEASE : test/name/for/realz.html = IMAGE')
expectation_line.matching_configurations = set([TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')])
- self.assertEqual(self._serializer.to_string(expectation_line), 'BUGX XP : test/name/for/realz.html = IMAGE')
+ self.assertEqual(expectation_line.to_string(self._converter), 'BUGX XP : test/name/for/realz.html = IMAGE')
- def test_parsed_expectations_string(self):
+ def test_serialize_parsed_expectations(self):
expectation_line = TestExpectationLine()
expectation_line.parsed_expectations = set([])
- self.assertEqual(self._serializer._parsed_expectations_string(expectation_line), '')
+ 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([IMAGE_PLUS_TEXT])
- self.assertEqual(self._serializer._parsed_expectations_string(expectation_line), 'image+text')
+ self.assertEqual(expectation_line._serialize_parsed_expectations(parsed_expectation_to_string), 'image+text')
expectation_line.parsed_expectations = set([PASS, IMAGE])
- self.assertEqual(self._serializer._parsed_expectations_string(expectation_line), 'pass image')
+ self.assertEqual(expectation_line._serialize_parsed_expectations(parsed_expectation_to_string), 'pass image')
expectation_line.parsed_expectations = set([TEXT, PASS])
- self.assertEqual(self._serializer._parsed_expectations_string(expectation_line), 'pass text')
+ self.assertEqual(expectation_line._serialize_parsed_expectations(parsed_expectation_to_string), 'pass text')
- def test_parsed_modifier_string(self):
+ def test_serialize_parsed_modifier_string(self):
expectation_line = TestExpectationLine()
expectation_line.parsed_bug_modifiers = ['garden-o-matic']
expectation_line.parsed_modifiers = ['for', 'the']
- self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, []), 'garden-o-matic for the')
- self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, ['win']), 'garden-o-matic for the win')
+ self.assertEqual(expectation_line._serialize_parsed_modifiers(self._converter, []), 'garden-o-matic for the')
+ self.assertEqual(expectation_line._serialize_parsed_modifiers(self._converter, ['win']), 'garden-o-matic for the win')
expectation_line.parsed_bug_modifiers = []
expectation_line.parsed_modifiers = []
- self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, []), '')
- self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, ['win']), 'win')
+ self.assertEqual(expectation_line._serialize_parsed_modifiers(self._converter, []), '')
+ self.assertEqual(expectation_line._serialize_parsed_modifiers(self._converter, ['win']), 'win')
expectation_line.parsed_bug_modifiers = ['garden-o-matic', 'total', 'is']
- self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, ['win']), 'garden-o-matic is total win')
+ self.assertEqual(expectation_line._serialize_parsed_modifiers(self._converter, ['win']), 'garden-o-matic is total win')
expectation_line.parsed_bug_modifiers = []
expectation_line.parsed_modifiers = ['garden-o-matic', 'total', 'is']
- self.assertEqual(self._serializer._parsed_modifier_string(expectation_line, ['win']), 'garden-o-matic is total win')
+ self.assertEqual(expectation_line._serialize_parsed_modifiers(self._converter, ['win']), 'garden-o-matic is total win')
- def test_format_result(self):
- self.assertEqual(TestExpectationSerializer._format_result('modifiers', 'name', 'expectations', 'comment'), 'MODIFIERS : name = EXPECTATIONS //comment')
- self.assertEqual(TestExpectationSerializer._format_result('modifiers', 'name', 'expectations', None), 'MODIFIERS : name = EXPECTATIONS')
+ 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')
def test_string_roundtrip(self):
self.assert_round_trip('')
@@ -690,9 +689,9 @@
add_line(set([TestConfiguration('xp', 'x86', 'release')]), True)
add_line(set([TestConfiguration('xp', 'x86', 'release'), TestConfiguration('xp', 'x86', 'debug')]), False)
- serialized = TestExpectationSerializer.list_to_string(lines, self._converter)
+ serialized = TestExpectations.list_to_string(lines, self._converter)
self.assertEquals(serialized, "BUGX XP RELEASE : Yay = IMAGE\nBUGX XP : Yay = IMAGE")
- serialized = TestExpectationSerializer.list_to_string(lines, self._converter, reconstitute_only_these=reconstitute_only_these)
+ serialized = TestExpectations.list_to_string(lines, self._converter, reconstitute_only_these=reconstitute_only_these)
self.assertEquals(serialized, "BUGX XP RELEASE : Yay = IMAGE\nNay")
def test_string_whitespace_stripping(self):
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/expectations.py (126333 => 126334)
--- trunk/Tools/Scripts/webkitpy/tool/commands/expectations.py 2012-08-22 19:30:08 UTC (rev 126333)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/expectations.py 2012-08-22 19:32:41 UTC (rev 126334)
@@ -27,7 +27,8 @@
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter
-from webkitpy.layout_tests.models.test_expectations import TestExpectationParser, TestExpectationSerializer
+from webkitpy.layout_tests.models.test_expectations import TestExpectationParser
+from webkitpy.layout_tests.models.test_expectations import TestExpectations
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
@@ -40,4 +41,4 @@
parser = TestExpectationParser(port, [], allow_rebaseline_modifier=False)
expectation_lines = parser.parse(port.test_expectations())
converter = TestConfigurationConverter(port.all_test_configurations(), port.configuration_specifier_macros())
- tool.filesystem.write_text_file(port.path_to_test_expectations_file(), TestExpectationSerializer.list_to_string(expectation_lines, converter))
+ tool.filesystem.write_text_file(port.path_to_test_expectations_file(), TestExpectations.list_to_string(expectation_lines, converter))
Modified: trunk/Tools/Scripts/webkitpy/tool/commands/queries.py (126333 => 126334)
--- trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2012-08-22 19:30:08 UTC (rev 126333)
+++ trunk/Tools/Scripts/webkitpy/tool/commands/queries.py 2012-08-22 19:32:41 UTC (rev 126334)
@@ -46,7 +46,7 @@
from webkitpy.tool.grammar import pluralize
from webkitpy.tool.multicommandtool import AbstractDeclarativeCommand
from webkitpy.common.system.deprecated_logging import log
-from webkitpy.layout_tests.models.test_expectations import TestExpectations, TestExpectationSerializer
+from webkitpy.layout_tests.models.test_expectations import TestExpectations
from webkitpy.layout_tests.port import port_options
@@ -465,7 +465,6 @@
default_port = tool.port_factory.get(options=options)
port_names = [default_port.name()]
- serializer = TestExpectationSerializer()
tests = default_port.tests(args)
for port_name in port_names:
model = self._model(options, port_name, tests)
@@ -473,7 +472,7 @@
lines = [model.get_expectation_line(test) for test in sorted(tests_to_print)]
if port_name != port_names[0]:
print
- print '\n'.join(self._format_lines(options, port_name, serializer, lines))
+ print '\n'.join(self._format_lines(options, port_name, lines))
def _filter_tests(self, options, model, tests):
filtered_tests = set()
@@ -487,17 +486,17 @@
filtered_tests.difference_update(model.get_test_set_for_keyword(keyword))
return filtered_tests
- def _format_lines(self, options, port_name, serializer, lines):
+ def _format_lines(self, options, port_name, lines):
output = []
if options.csv:
for line in lines:
- output.append("%s,%s" % (port_name, serializer.to_csv(line)))
+ output.append("%s,%s" % (port_name, line.to_csv()))
elif lines:
include_modifiers = options.full
include_expectations = options.full or len(options.include_keyword) != 1 or len(options.exclude_keyword)
output.append("// For %s" % port_name)
for line in lines:
- output.append("%s" % serializer.to_string(line, include_modifiers, include_expectations, include_comment=False))
+ output.append("%s" % line.to_string(None, include_modifiers, include_expectations, include_comment=False))
return output
def _model(self, options, port_name, tests):
Modified: trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py (126333 => 126334)
--- trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2012-08-22 19:30:08 UTC (rev 126333)
+++ trunk/Tools/Scripts/webkitpy/tool/servers/gardeningserver.py 2012-08-22 19:32:41 UTC (rev 126334)
@@ -30,7 +30,7 @@
from webkitpy.common.memoized import memoized
from webkitpy.tool.servers.reflectionhandler import ReflectionHandler
from webkitpy.layout_tests.controllers.test_expectations_editor import BugManager, TestExpectationsEditor
-from webkitpy.layout_tests.models.test_expectations import TestExpectationParser, TestExpectations, TestExpectationSerializer
+from webkitpy.layout_tests.models.test_expectations import TestExpectationParser, TestExpectations
from webkitpy.layout_tests.models.test_configuration import TestConfigurationConverter
from webkitpy.layout_tests.port import builders
@@ -82,7 +82,7 @@
builder_name = failure_info['builderName']
affected_test_configuration_set = self._extrapolator.extrapolate_test_configurations(builder_name)
updated_expectation_lines.extend(editor.update_expectation(test_name, affected_test_configuration_set, expectation_set))
- self._tool.filesystem.write_text_file(self._path_to_test_expectations_file, TestExpectationSerializer.list_to_string(expectation_lines, self._converter, reconstitute_only_these=updated_expectation_lines))
+ self._tool.filesystem.write_text_file(self._path_to_test_expectations_file, TestExpectations.list_to_string(expectation_lines, self._converter, reconstitute_only_these=updated_expectation_lines))
class GardeningHTTPServer(BaseHTTPServer.HTTPServer):