Changeset 112298 in webkit
- Timestamp:
- Mar 27, 2012 12:15:53 PM (12 years ago)
- Location:
- trunk/Tools
- Files:
-
- 2 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Tools/ChangeLog
r112294 r112298 1 2012-03-27 Dirk Pranke <dpranke@chromium.org> 2 3 test-webkitpy: prepare for better test run output 4 https://bugs.webkit.org/show_bug.cgi?id=82290 5 6 Reviewed by Adam Barth. 7 8 This code basically re-implements the output of the TextTestRunner default 9 runner code from unittest, although the implementation is quite 10 different, in preparation for changing the test output to be 11 metered and possibly running in parallel. 12 13 The output is almost identical to before, except that instead of 14 logging "test_regular (webkitpy.main.RunnerTest) passed" we log 15 "webkitpy.main.RunnerTest.test_regular passed". It has always 16 annoyed me that they invert the names to be harder to read and 17 so that you can't copy & paste back to the input for 18 test-webkitpy. 19 20 This patch is provided to add a skeleton for unit tests and for 21 comparison to an upcoming patch that will actually add new 22 functionality. 23 24 * Scripts/webkitpy/test/main.py: 25 (Tester.__init__): 26 (Tester._configure_logging): 27 (Tester._run_tests): 28 * Scripts/webkitpy/test/runner.py: Added. 29 (TestRunner): 30 (TestRunner.__init__): 31 (TestRunner.test_name): 32 (TestRunner.all_test_names): 33 (TestRunner.run): 34 (TestRunner.write_result): 35 (TestRunner.write_summary): 36 * Scripts/webkitpy/test/runner_unittest.py: Added. 37 (FakeModuleSuite): 38 (FakeModuleSuite.__init__): 39 (FakeModuleSuite.__str__): 40 (FakeModuleSuite.run): 41 (FakeTopSuite): 42 (FakeTopSuite.__init__): 43 (FakeLoader): 44 (FakeLoader.__init__): 45 (FakeLoader.top_suite): 46 (FakeLoader.loadTestsFromName): 47 (RunnerTest): 48 (RunnerTest.test_regular): 49 (RunnerTest.test_verbose): 50 1 51 2012-03-27 Gustavo Noronha Silva <gns@gnome.org> 2 52 -
trunk/Tools/Scripts/webkitpy/test/main.py
r112168 r112298 33 33 from webkitpy.common.system.filesystem import FileSystem 34 34 from webkitpy.test.test_finder import TestFinder 35 from webkitpy.test.runner import TestRunner 35 36 36 37 _log = logging.getLogger(__name__) … … 41 42 self._verbosity = 1 42 43 self.finder = TestFinder(filesystem or FileSystem()) 44 self.stream = sys.stderr 43 45 44 46 def add_tree(self, top_directory, starting_subdirectory=None): … … 93 95 logging level as described below. 94 96 """ 95 handler = logging.StreamHandler(s ys.stderr)97 handler = logging.StreamHandler(self.stream) 96 98 # We constrain the level on the handler rather than on the root 97 99 # logger itself. This is probably better because the handler is … … 143 145 return self._run_tests(names) 144 146 145 def _run_tests(self, args):147 def _run_tests(self, names): 146 148 if self._options.coverage: 147 149 try: … … 160 162 loader = unittest.defaultTestLoader 161 163 suites = [] 162 for name in args:164 for name in names: 163 165 if self.finder.is_module(name): 164 # import modules explicitly before loading their tests because 165 # loadTestsFromName() produces lousy error messages for bad modules. 166 # if we failed to load a name and it looks like a module, 167 # try importing it directly, because loadTestsFromName() 168 # produces lousy error messages for bad modules. 166 169 try: 167 170 __import__(name) … … 170 173 self._log_exception() 171 174 return False 175 172 176 suites.append(loader.loadTestsFromName(name, None)) 173 177 … … 177 181 test_runner = XMLTestRunner(output='test-webkitpy-xml-reports') 178 182 else: 179 test_runner = unittest.TextTestRunner(verbosity=self._verbosity)183 test_runner = TestRunner(self.stream, self._options, loader) 180 184 181 185 _log.debug("Running the tests.")
Note: See TracChangeset
for help on using the changeset viewer.