Title: [133055] trunk/Tools
Revision
133055
Author
[email protected]
Date
2012-10-31 12:01:37 -0700 (Wed, 31 Oct 2012)

Log Message

test-webkitpy: fix running modules and classes on the command line
https://bugs.webkit.org/show_bug.cgi?id=100787

Reviewed by Eric Seidel.

Handling modules and classes are arguments on the command line
was broken due to the way we were parsing test names looking for
parallel and serial tests.

* Scripts/webkitpy/test/main.py:
(Tester._test_names):
(_Loader):
* Scripts/webkitpy/test/main_unittest.py:
(TestStubs.integration_test_empty):
(TestStubs):
(TestStubs.serial_test_empty):
(TestStubs.serial_integration_test_empty):
(TesterTest._find_test_names):
(TesterTest):
(TesterTest.test_individual_names_are_not_run_twice):
(TesterTest.test_integration_tests_are_not_found_by_default):
(TesterTest.test_integration_tests_are_found):

Modified Paths

Diff

Modified: trunk/Tools/ChangeLog (133054 => 133055)


--- trunk/Tools/ChangeLog	2012-10-31 18:51:06 UTC (rev 133054)
+++ trunk/Tools/ChangeLog	2012-10-31 19:01:37 UTC (rev 133055)
@@ -1,5 +1,30 @@
 2012-10-31  Dirk Pranke  <[email protected]>
 
+        test-webkitpy: fix running modules and classes on the command line
+        https://bugs.webkit.org/show_bug.cgi?id=100787
+
+        Reviewed by Eric Seidel.
+
+        Handling modules and classes are arguments on the command line
+        was broken due to the way we were parsing test names looking for
+        parallel and serial tests.
+
+        * Scripts/webkitpy/test/main.py:
+        (Tester._test_names):
+        (_Loader):
+        * Scripts/webkitpy/test/main_unittest.py:
+        (TestStubs.integration_test_empty):
+        (TestStubs):
+        (TestStubs.serial_test_empty):
+        (TestStubs.serial_integration_test_empty):
+        (TesterTest._find_test_names):
+        (TesterTest):
+        (TesterTest.test_individual_names_are_not_run_twice):
+        (TesterTest.test_integration_tests_are_not_found_by_default):
+        (TesterTest.test_integration_tests_are_found):
+
+2012-10-31  Dirk Pranke  <[email protected]>
+
         webkitpy: refactor common command line arguments for --platform, rebaseline commands
         https://bugs.webkit.org/show_bug.cgi?id=100800
 

Modified: trunk/Tools/Scripts/webkitpy/test/main.py (133054 => 133055)


--- trunk/Tools/Scripts/webkitpy/test/main.py	2012-10-31 18:51:06 UTC (rev 133054)
+++ trunk/Tools/Scripts/webkitpy/test/main.py	2012-10-31 19:01:37 UTC (rev 133055)
@@ -178,17 +178,19 @@
         return True
 
     def _test_names(self, loader, names):
+        parallel_test_method_prefixes = ['test_']
+        serial_test_method_prefixes = ['serial_test_']
         if self._options.integration_tests:
-            loader.test_method_prefixes.append('integration_test_')
+            parallel_test_method_prefixes.append('integration_test_')
+            serial_test_method_prefixes.append('serial_integration_test_')
 
         parallel_tests = []
-        if self._options.child_processes > 1:
-            for name in names:
-                parallel_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
-            loader.test_method_prefixes = []
+        loader.test_method_prefixes = parallel_test_method_prefixes
+        for name in names:
+            parallel_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
 
         serial_tests = []
-        loader.test_method_prefixes = ['serial_test_', 'serial_integration_test_']
+        loader.test_method_prefixes = serial_test_method_prefixes
         for name in names:
             serial_tests.extend(self._all_test_names(loader.loadTestsFromName(name, None)))
 
@@ -216,7 +218,7 @@
 
 
 class _Loader(unittest.TestLoader):
-    test_method_prefixes = ['test_']
+    test_method_prefixes = []
 
     def getTestCaseNames(self, testCaseClass):
         def isTestMethod(attrname, testCaseClass=testCaseClass):

Modified: trunk/Tools/Scripts/webkitpy/test/main_unittest.py (133054 => 133055)


--- trunk/Tools/Scripts/webkitpy/test/main_unittest.py	2012-10-31 18:51:06 UTC (rev 133054)
+++ trunk/Tools/Scripts/webkitpy/test/main_unittest.py	2012-10-31 19:01:37 UTC (rev 133055)
@@ -38,7 +38,16 @@
     def test_empty(self):
         pass
 
+    def integration_test_empty(self):
+        pass
 
+    def serial_test_empty(self):
+        pass
+
+    def serial_integration_test_empty(self):
+        pass
+
+
 class TesterTest(unittest.TestCase):
 
     def test_no_tests_found(self):
@@ -64,13 +73,37 @@
         self.assertTrue('No tests to run' in errors.getvalue())
         self.assertTrue('No tests to run' in logs)
 
+    def _find_test_names(self, args):
+        tester = Tester()
+        tester._options, args = tester._parse_args(args)
+        return tester._test_names(_Loader(), args)
+
     def test_individual_names_are_not_run_twice(self):
-        tester = Tester()
-        tester._options, args = tester._parse_args(["webkitpy.test.main_unittest.TesterTest.test_no_tests_found"])
-        parallel_tests, serial_tests = tester._test_names(_Loader(), args)
+        args = [STUBS_CLASS + '.test_empty']
+        parallel_tests, serial_tests = self._find_test_names(args)
         self.assertEquals(parallel_tests, args)
         self.assertEquals(serial_tests, [])
 
+    def test_integration_tests_are_not_found_by_default(self):
+        parallel_tests, serial_tests = self._find_test_names([STUBS_CLASS])
+        self.assertEquals(parallel_tests, [
+            STUBS_CLASS + '.test_empty',
+            ])
+        self.assertEquals(serial_tests, [
+            STUBS_CLASS + '.serial_test_empty',
+            ])
+
+    def test_integration_tests_are_found(self):
+        parallel_tests, serial_tests = self._find_test_names(['--integration-tests', STUBS_CLASS])
+        self.assertEquals(parallel_tests, [
+            STUBS_CLASS + '.integration_test_empty',
+            STUBS_CLASS + '.test_empty',
+            ])
+        self.assertEquals(serial_tests, [
+            STUBS_CLASS + '.serial_integration_test_empty',
+            STUBS_CLASS + '.serial_test_empty',
+            ])
+
     def integration_test_coverage_works(self):
         filesystem = FileSystem()
         executive = Executive()
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to