Unmuddle construction options for TestConfiguration.
authordglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Aug 2011 17:08:47 +0000 (17:08 +0000)
committerdglazkov@chromium.org <dglazkov@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 10 Aug 2011 17:08:47 +0000 (17:08 +0000)
https://bugs.webkit.org/show_bug.cgi?id=65988

The TestConfiguration instance is now constructed only using actual values.
Port-based construction is split into a "from_port" class method.

Reviewed by Eric Seidel.

* Scripts/webkitpy/layout_tests/models/test_configuration.py: Added TestConfiguration.from_port
* Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py: Adjusted code to accommodate the change.
* Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Ditto.
* Scripts/webkitpy/layout_tests/port/base.py: Ditto.
* Scripts/webkitpy/layout_tests/port/webkit_unittest.py: Ditto.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@92775 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Tools/ChangeLog
Tools/Scripts/webkitpy/layout_tests/models/test_configuration.py
Tools/Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py
Tools/Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py
Tools/Scripts/webkitpy/layout_tests/port/base.py
Tools/Scripts/webkitpy/layout_tests/port/webkit_unittest.py

index 3f3ca42..fe9a454 100644 (file)
@@ -1,3 +1,19 @@
+2011-08-10  Dimitri Glazkov  <dglazkov@chromium.org>
+
+        Unmuddle construction options for TestConfiguration.
+        https://bugs.webkit.org/show_bug.cgi?id=65988
+
+        The TestConfiguration instance is now constructed only using actual values.
+        Port-based construction is split into a "from_port" class method.
+
+        Reviewed by Eric Seidel.
+
+        * Scripts/webkitpy/layout_tests/models/test_configuration.py: Added TestConfiguration.from_port
+        * Scripts/webkitpy/layout_tests/models/test_configuration_unittest.py: Adjusted code to accommodate the change.
+        * Scripts/webkitpy/layout_tests/models/test_expectations_unittest.py: Ditto.
+        * Scripts/webkitpy/layout_tests/port/base.py: Ditto.
+        * Scripts/webkitpy/layout_tests/port/webkit_unittest.py: Ditto.
+
 2011-08-10  Eric Seidel  <eric@webkit.org>
 
         Leaks bot shows python logging prefixes as part of summary display
index 0576ddd..e05c343 100644 (file)
 
 
 class TestConfiguration(object):
-    def __init__(self, port=None, version=None, architecture=None, build_type=None, graphics_type=None):
-        # FIXME: TestConfiguration() fails due to port == None.
-        self.version = version or port.version()
-        self.architecture = architecture or port.architecture()
-        self.build_type = build_type or port.options.configuration.lower()
-        self.graphics_type = graphics_type or port.graphics_type()
+    def __init__(self, version, architecture, build_type, graphics_type):
+        self.version = version
+        self.architecture = architecture
+        self.build_type = build_type
+        self.graphics_type = graphics_type
+
+    @classmethod
+    def from_port(cls, port):
+        assert(port)
+        version = port.version()
+        architecture = port.architecture()
+        build_type = port.options.configuration.lower()
+        graphics_type = port.graphics_type()
+        return TestConfiguration(version, architecture, build_type, graphics_type)
 
     @classmethod
     def category_order(cls):
index b680ba1..c4d7e8a 100644 (file)
@@ -37,7 +37,7 @@ def make_mock_all_test_configurations_set():
     for version, architecture in (('snowleopard', 'x86'), ('xp', 'x86'), ('win7', 'x86'), ('lucid', 'x86'), ('lucid', 'x86_64')):
         for build_type in ('debug', 'release'):
             for graphics_type in ('cpu', 'gpu'):
-                all_test_configurations.add(TestConfiguration(None, version, architecture, build_type, graphics_type))
+                all_test_configurations.add(TestConfiguration(version, architecture, build_type, graphics_type))
     return all_test_configurations
 
 MOCK_MACROS = {
@@ -49,60 +49,60 @@ MOCK_MACROS = {
 
 class TestConfigurationTest(unittest.TestCase):
     def test_items(self):
-        config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+        config = TestConfiguration('xp', 'x86', 'release', 'cpu')
         result_config_dict = {}
         for category, specifier in config.items():
             result_config_dict[category] = specifier
         self.assertEquals({'version': 'xp', 'architecture': 'x86', 'build_type': 'release', 'graphics_type': 'cpu'}, result_config_dict)
 
     def test_keys(self):
-        config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+        config = TestConfiguration('xp', 'x86', 'release', 'cpu')
         result_config_keys = []
         for category in config.keys():
             result_config_keys.append(category)
         self.assertEquals(set(['graphics_type', 'version', 'architecture', 'build_type']), set(result_config_keys))
 
     def test_str(self):
-        config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+        config = TestConfiguration('xp', 'x86', 'release', 'cpu')
         self.assertEquals('<xp, x86, release, cpu>', str(config))
 
     def test_repr(self):
-        config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+        config = TestConfiguration('xp', 'x86', 'release', 'cpu')
         self.assertEquals("TestConfig(version='xp', architecture='x86', build_type='release', graphics_type='cpu')", repr(config))
 
     def test_hash(self):
         config_dict = {}
-        config_dict[TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')] = True
-        self.assertTrue(TestConfiguration(None, 'xp', 'x86', 'release', 'cpu') in config_dict)
-        self.assertTrue(config_dict[TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')])
-        config_dict[TestConfiguration(None, 'xp', 'x86', 'release', 'gpu')] = False
-        self.assertFalse(config_dict[TestConfiguration(None, 'xp', 'x86', 'release', 'gpu')])
+        config_dict[TestConfiguration('xp', 'x86', 'release', 'cpu')] = True
+        self.assertTrue(TestConfiguration('xp', 'x86', 'release', 'cpu') in config_dict)
+        self.assertTrue(config_dict[TestConfiguration('xp', 'x86', 'release', 'cpu')])
+        config_dict[TestConfiguration('xp', 'x86', 'release', 'gpu')] = False
+        self.assertFalse(config_dict[TestConfiguration('xp', 'x86', 'release', 'gpu')])
 
         def query_unknown_key():
-            config_dict[TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu')]
+            config_dict[TestConfiguration('xp', 'x86', 'debug', 'gpu')]
 
         self.assertRaises(KeyError, query_unknown_key)
-        self.assertTrue(TestConfiguration(None, 'xp', 'x86', 'release', 'gpu') in config_dict)
-        self.assertFalse(TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu') in config_dict)
-        configs_list = [TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'), TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu'), TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu')]
+        self.assertTrue(TestConfiguration('xp', 'x86', 'release', 'gpu') in config_dict)
+        self.assertFalse(TestConfiguration('xp', 'x86', 'debug', 'gpu') in config_dict)
+        configs_list = [TestConfiguration('xp', 'x86', 'release', 'gpu'), TestConfiguration('xp', 'x86', 'debug', 'gpu'), TestConfiguration('xp', 'x86', 'debug', 'gpu')]
         self.assertEquals(len(configs_list), 3)
         self.assertEquals(len(set(configs_list)), 2)
 
     def test_eq(self):
-        self.assertEquals(TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'))
-        self.assertEquals(TestConfiguration(port.get('test-win-xp', None)), TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'))
-        self.assertNotEquals(TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'))
-        self.assertNotEquals(TestConfiguration(None, 'xp', 'x86', 'debug', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'))
+        self.assertEquals(TestConfiguration('xp', 'x86', 'release', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
+        self.assertEquals(TestConfiguration.from_port(port.get('test-win-xp', None)), TestConfiguration('xp', 'x86', 'release', 'cpu'))
+        self.assertNotEquals(TestConfiguration('xp', 'x86', 'release', 'gpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
+        self.assertNotEquals(TestConfiguration('xp', 'x86', 'debug', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'cpu'))
 
     def test_values(self):
-        config = TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')
+        config = TestConfiguration('xp', 'x86', 'release', 'cpu')
         result_config_values = []
         for value in config.values():
             result_config_values.append(value)
         self.assertEquals(set(['xp', 'x86', 'release', 'cpu']), set(result_config_values))
 
-    def test_port_init(self):
-        config = TestConfiguration(port.get('test-win-xp', None))
+    def test_from_port(self):
+        config = TestConfiguration.from_port(port.get('test-win-xp', None))
         self.assertEquals('<xp, x86, release, cpu>', str(config))
 
 
@@ -179,60 +179,60 @@ class TestConfigurationConverterTest(unittest.TestCase):
         self.assertEquals(converter.to_config_set(set(['xp', 'x86_64'])), set())
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'cpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['xp', 'release'])), configs_to_match)
 
         configs_to_match = set([
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86_64', 'release', 'gpu'),
        ])
         self.assertEquals(converter.to_config_set(set(['gpu', 'release'])), configs_to_match)
 
         configs_to_match = set([
-             TestConfiguration(None, 'lucid', 'x86_64', 'release', 'gpu'),
-             TestConfiguration(None, 'lucid', 'x86_64', 'debug', 'gpu'),
-             TestConfiguration(None, 'lucid', 'x86_64', 'release', 'cpu'),
-             TestConfiguration(None, 'lucid', 'x86_64', 'debug', 'cpu'),
+             TestConfiguration('lucid', 'x86_64', 'release', 'gpu'),
+             TestConfiguration('lucid', 'x86_64', 'debug', 'gpu'),
+             TestConfiguration('lucid', 'x86_64', 'release', 'cpu'),
+             TestConfiguration('lucid', 'x86_64', 'debug', 'cpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['x86_64'])), configs_to_match)
 
         configs_to_match = set([
-            TestConfiguration(None, 'lucid', 'x86_64', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'debug', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'release', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'debug', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'debug', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'debug', 'cpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'debug', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'debug', 'cpu'),
+            TestConfiguration('lucid', 'x86_64', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86_64', 'debug', 'gpu'),
+            TestConfiguration('lucid', 'x86_64', 'release', 'cpu'),
+            TestConfiguration('lucid', 'x86_64', 'debug', 'cpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'debug', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'cpu'),
+            TestConfiguration('lucid', 'x86', 'debug', 'cpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'debug', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'cpu'),
+            TestConfiguration('snowleopard', 'x86', 'debug', 'cpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['lucid', 'snowleopard'])), configs_to_match)
 
         configs_to_match = set([
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'debug', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'debug', 'cpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'debug', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'debug', 'cpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'debug', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'cpu'),
+            TestConfiguration('lucid', 'x86', 'debug', 'cpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'debug', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'cpu'),
+            TestConfiguration('snowleopard', 'x86', 'debug', 'cpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['lucid', 'snowleopard', 'x86'])), configs_to_match)
 
         configs_to_match = set([
-            TestConfiguration(None, 'lucid', 'x86_64', 'release', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'cpu'),
+            TestConfiguration('lucid', 'x86_64', 'release', 'cpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'cpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'cpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['lucid', 'snowleopard', 'release', 'cpu'])), configs_to_match)
 
@@ -240,25 +240,25 @@ class TestConfigurationConverterTest(unittest.TestCase):
         converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'cpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'cpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'cpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['win', 'release'])), configs_to_match)
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86_64', 'release', 'gpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['win', 'lucid', 'release', 'gpu'])), configs_to_match)
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
         ])
         self.assertEquals(converter.to_config_set(set(['win', 'mac', 'release', 'gpu'])), configs_to_match)
 
@@ -269,56 +269,56 @@ class TestConfigurationConverterTest(unittest.TestCase):
         self.assertEquals(converter.to_specifiers_list(set()), [])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'cpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'debug', 'cpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'cpu'),
+            TestConfiguration('xp', 'x86', 'debug', 'gpu'),
+            TestConfiguration('xp', 'x86', 'debug', 'cpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['xp'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'debug', 'cpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86_64', 'debug', 'cpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['debug', 'x86_64', 'lucid', 'cpu']), set(['release', 'gpu', 'xp'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'debug', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'debug', 'cpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'debug', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'debug', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'cpu'),
+            TestConfiguration('lucid', 'x86_64', 'debug', 'cpu'),
+            TestConfiguration('lucid', 'x86', 'debug', 'cpu'),
+            TestConfiguration('lucid', 'x86_64', 'debug', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'debug', 'gpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release', 'xp']), set(['debug', 'lucid'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86_64', 'release', 'gpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release', 'gpu'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['xp', 'snowleopard', 'release', 'gpu'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'debug', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'debug', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'gpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['release', 'gpu', 'lucid', 'x86']), set(['gpu', 'win7']), set(['release', 'gpu', 'xp', 'snowleopard'])])
 
@@ -345,25 +345,25 @@ class TestConfigurationConverterTest(unittest.TestCase):
         converter = TestConfigurationConverter(self._all_test_configurations, MOCK_MACROS)
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'cpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'cpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'cpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'release'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'lucid', 'x86_64', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86', 'release', 'gpu'),
+            TestConfiguration('lucid', 'x86_64', 'release', 'gpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'linux', 'release', 'gpu'])])
 
         configs_to_match = set([
-            TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-            TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
+            TestConfiguration('xp', 'x86', 'release', 'gpu'),
+            TestConfiguration('win7', 'x86', 'release', 'gpu'),
+            TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
         ])
         self.assertEquals(converter.to_specifiers_list(configs_to_match), [set(['win', 'mac', 'release', 'gpu'])])
 
index 7087f26..c982695 100644 (file)
@@ -507,11 +507,11 @@ class TestExpectationSerializerTests(unittest.TestCase):
         expectation_line.name = 'test/name/for/realz.html'
         expectation_line.parsed_expectations = set([IMAGE])
         self.assertEqual(self._serializer.to_string(expectation_line), None)
-        expectation_line.matching_configurations = set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')])
+        expectation_line.matching_configurations = set([TestConfiguration('xp', 'x86', 'release', 'cpu')])
         self.assertEqual(self._serializer.to_string(expectation_line), 'BUGX XP RELEASE CPU : test/name/for/realz.html = IMAGE')
-        expectation_line.matching_configurations = set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'gpu')])
+        expectation_line.matching_configurations = set([TestConfiguration('xp', 'x86', 'release', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'gpu')])
         self.assertEqual(self._serializer.to_string(expectation_line), 'BUGX XP RELEASE : test/name/for/realz.html = IMAGE')
-        expectation_line.matching_configurations = set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu')])
+        expectation_line.matching_configurations = set([TestConfiguration('xp', 'x86', 'release', 'cpu'), TestConfiguration('xp', 'x86', 'debug', 'gpu')])
         self.assertEqual(self._serializer.to_string(expectation_line), 'BUGX XP RELEASE CPU : test/name/for/realz.html = IMAGE\nBUGX XP DEBUG GPU : test/name/for/realz.html = IMAGE')
 
     def test_parsed_expectations_string(self):
@@ -592,9 +592,9 @@ class TestExpectationSerializerTests(unittest.TestCase):
             if reconstitute:
                 reconstitute_only_these.append(expectation_line)
 
-        add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')]), False)
-        add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'gpu')]), True)
-        add_line(set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'), TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu')]), False)
+        add_line(set([TestConfiguration('xp', 'x86', 'release', 'cpu')]), False)
+        add_line(set([TestConfiguration('xp', 'x86', 'release', 'cpu'), TestConfiguration('xp', 'x86', 'release', 'gpu')]), True)
+        add_line(set([TestConfiguration('xp', 'x86', 'release', 'cpu'), TestConfiguration('xp', 'x86', 'debug', 'gpu')]), False)
         serialized = TestExpectationSerializer.list_to_string(lines, self._converter)
         self.assertEquals(serialized, "BUGX XP RELEASE CPU : Yay = IMAGE\nBUGX XP RELEASE : Yay = IMAGE\nBUGX XP RELEASE CPU : Yay = IMAGE\nBUGX XP DEBUG GPU : Yay = IMAGE")
         serialized = TestExpectationSerializer.list_to_string(lines, self._converter, reconstitute_only_these=reconstitute_only_these)
@@ -612,26 +612,26 @@ class TestExpectationSerializerTests(unittest.TestCase):
 
 class TestExpectationEditorTests(unittest.TestCase):
     WIN_RELEASE_CPU_CONFIGS = set([
-        TestConfiguration(None, 'vista', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'win7', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
+        TestConfiguration('vista', 'x86', 'release', 'cpu'),
+        TestConfiguration('win7', 'x86', 'release', 'cpu'),
+        TestConfiguration('xp', 'x86', 'release', 'cpu'),
     ])
 
     RELEASE_CONFIGS = set([
-        TestConfiguration(None, 'vista', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'win7', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'xp', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'vista', 'x86', 'release', 'gpu'),
-        TestConfiguration(None, 'win7', 'x86', 'release', 'gpu'),
-        TestConfiguration(None, 'xp', 'x86', 'release', 'gpu'),
-        TestConfiguration(None, 'snowleopard', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'leopard', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'snowleopard', 'x86', 'release', 'gpu'),
-        TestConfiguration(None, 'leopard', 'x86', 'release', 'gpu'),
-        TestConfiguration(None, 'lucid', 'x86', 'release', 'cpu'),
-        TestConfiguration(None, 'lucid', 'x86_64', 'release', 'cpu'),
-        TestConfiguration(None, 'lucid', 'x86', 'release', 'gpu'),
-        TestConfiguration(None, 'lucid', 'x86_64', 'release', 'gpu'),
+        TestConfiguration('vista', 'x86', 'release', 'cpu'),
+        TestConfiguration('win7', 'x86', 'release', 'cpu'),
+        TestConfiguration('xp', 'x86', 'release', 'cpu'),
+        TestConfiguration('vista', 'x86', 'release', 'gpu'),
+        TestConfiguration('win7', 'x86', 'release', 'gpu'),
+        TestConfiguration('xp', 'x86', 'release', 'gpu'),
+        TestConfiguration('snowleopard', 'x86', 'release', 'cpu'),
+        TestConfiguration('leopard', 'x86', 'release', 'cpu'),
+        TestConfiguration('snowleopard', 'x86', 'release', 'gpu'),
+        TestConfiguration('leopard', 'x86', 'release', 'gpu'),
+        TestConfiguration('lucid', 'x86', 'release', 'cpu'),
+        TestConfiguration('lucid', 'x86_64', 'release', 'cpu'),
+        TestConfiguration('lucid', 'x86', 'release', 'gpu'),
+        TestConfiguration('lucid', 'x86_64', 'release', 'gpu'),
     ])
 
     def __init__(self, testFunc):
@@ -756,20 +756,20 @@ BUGX2 WIN : failures/expected/audio.html = IMAGE"""
         editor = TestExpectationsEditor(expectation_lines, MockBugManager())
         test = "failures/expected/keyboard.html"
 
-        editor.remove_expectation(test, set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')]))
+        editor.remove_expectation(test, set([TestConfiguration('xp', 'x86', 'release', 'cpu')]))
         self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
 BUGX1 XP RELEASE GPU : failures/expected/keyboard.html = IMAGE
 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(None, 'xp', 'x86', 'debug', 'cpu')]))
+        editor.remove_expectation(test, set([TestConfiguration('xp', 'x86', 'debug', 'cpu')]))
         self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
 BUGX1 XP GPU : 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(None, 'vista', 'x86', 'debug', 'gpu'), TestConfiguration(None, 'win7', 'x86', 'release', 'gpu')]))
+        editor.remove_expectation(test, set([TestConfiguration('vista', 'x86', 'debug', 'gpu'), TestConfiguration('win7', 'x86', 'release', 'gpu')]))
         self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
 BUGX1 VISTA DEBUG CPU : failures/expected/keyboard.html = IMAGE
 BUGX1 WIN7 DEBUG GPU : failures/expected/keyboard.html = IMAGE
@@ -778,7 +778,7 @@ BUGX1 XP GPU : failures/expected/keyboard.html = IMAGE
 BUGX1 VISTA RELEASE : failures/expected/keyboard.html = IMAGE
 BUGX2 WIN : failures/expected/audio.html = IMAGE""")
 
-        editor.remove_expectation(test, set([TestConfiguration(None, 'xp', 'x86', 'debug', 'gpu'), TestConfiguration(None, 'xp', 'x86', 'release', 'gpu')]))
+        editor.remove_expectation(test, set([TestConfiguration('xp', 'x86', 'debug', 'gpu'), TestConfiguration('xp', 'x86', 'release', 'gpu')]))
         self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
 BUGX1 VISTA DEBUG CPU : failures/expected/keyboard.html = IMAGE
 BUGX1 WIN7 RELEASE CPU : failures/expected/keyboard.html = IMAGE
@@ -786,7 +786,7 @@ BUGX1 WIN7 DEBUG : failures/expected/keyboard.html = IMAGE
 BUGX1 VISTA RELEASE : failures/expected/keyboard.html = IMAGE
 BUGX2 WIN : failures/expected/audio.html = IMAGE""")
 
-        editor.remove_expectation(test, set([TestConfiguration(None, 'vista', 'x86', 'debug', 'cpu'), TestConfiguration(None, 'vista', 'x86', 'debug', 'gpu'), TestConfiguration(None, 'vista', 'x86', 'release', 'gpu')]))
+        editor.remove_expectation(test, set([TestConfiguration('vista', 'x86', 'debug', 'cpu'), TestConfiguration('vista', 'x86', 'debug', 'gpu'), TestConfiguration('vista', 'x86', 'release', 'gpu')]))
         self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
 BUGX1 WIN7 DEBUG : failures/expected/keyboard.html = IMAGE
 BUGX1 VISTA WIN7 RELEASE CPU : failures/expected/keyboard.html = IMAGE
@@ -887,7 +887,7 @@ BUGX2 WIN : failures/expected/audio.html = IMAGE"""
         editor = TestExpectationsEditor(expectation_lines, MockBugManager())
         test = "failures/expected/keyboard.html"
 
-        editor.update_expectation(test, set([TestConfiguration(None, 'xp', 'x86', 'release', 'cpu')]), set([IMAGE_PLUS_TEXT]), ['BUG_UPDATE1'])
+        editor.update_expectation(test, set([TestConfiguration('xp', 'x86', 'release', 'cpu')]), set([IMAGE_PLUS_TEXT]), ['BUG_UPDATE1'])
         self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
 BUGX1 XP DEBUG CPU : failures/expected/keyboard.html = IMAGE
 BUGX1 XP GPU : failures/expected/keyboard.html = IMAGE
@@ -895,7 +895,7 @@ BUGX1 VISTA WIN7 : failures/expected/keyboard.html = IMAGE
 BUGX2 WIN : failures/expected/audio.html = IMAGE
 BUG_UPDATE1 XP RELEASE CPU : failures/expected/keyboard.html = IMAGE+TEXT""")
 
-        editor.update_expectation(test, set([TestConfiguration(None, 'xp', 'x86', 'debug', 'cpu')]), set([TEXT]), ['BUG_UPDATE2'])
+        editor.update_expectation(test, set([TestConfiguration('xp', 'x86', 'debug', 'cpu')]), set([TEXT]), ['BUG_UPDATE2'])
         self.assertEquals(TestExpectationSerializer.list_to_string(expectation_lines, converter), """
 BUGX1 XP GPU : failures/expected/keyboard.html = IMAGE
 BUGX1 VISTA WIN7 : failures/expected/keyboard.html = IMAGE
index ac4f4bc..7cf499b 100755 (executable)
@@ -728,7 +728,7 @@ class Port(object):
     def test_configuration(self):
         """Returns the current TestConfiguration for the port."""
         if not self._test_configuration:
-            self._test_configuration = TestConfiguration(self)
+            self._test_configuration = TestConfiguration.from_port(self)
         return self._test_configuration
 
     # FIXME: Belongs on a Platform object.
index 25c392f..f1d761e 100755 (executable)
@@ -52,7 +52,7 @@ class TestWebKitPort(WebKitPort):
         WebKitPort.__init__(self, executive=executive, filesystem=filesystem, user=MockUser(), **kwargs)
 
     def all_test_configurations(self):
-        return [TestConfiguration(self)]
+        return [TestConfiguration.from_port(self)]
 
     def _runtime_feature_list(self):
         return self.feature_list