[Python-checkins] r74007 - in python/trunk/Lib: test/test_unittest.py unittest.py
michael.foord
python-checkins at python.org
Tue Jul 14 19:58:18 CEST 2009
Author: michael.foord
Date: Tue Jul 14 19:58:12 2009
New Revision: 74007
Log:
Move TestRunner initialisation into unittest.TestProgram.runTests. Fixes issue 6418.
Modified:
python/trunk/Lib/test/test_unittest.py
python/trunk/Lib/unittest.py
Modified: python/trunk/Lib/test/test_unittest.py
==============================================================================
--- python/trunk/Lib/test/test_unittest.py (original)
+++ python/trunk/Lib/test/test_unittest.py Tue Jul 14 19:58:12 2009
@@ -3324,15 +3324,6 @@
self.assertEqual(runner.test, test)
self.assertEqual(program.verbosity, 2)
-
- def testTestProgram_testRunnerArgument(self):
- program = object.__new__(TestProgram)
- program.parseArgs = lambda _: None
- program.runTests = lambda: None
- program.__init__(testRunner=None)
- self.assertEqual(program.testRunner, unittest.TextTestRunner)
-
-
class FooBar(unittest.TestCase):
def testPass(self):
assert True
Modified: python/trunk/Lib/unittest.py
==============================================================================
--- python/trunk/Lib/unittest.py (original)
+++ python/trunk/Lib/unittest.py Tue Jul 14 19:58:12 2009
@@ -1643,8 +1643,6 @@
argv=None, testRunner=None,
testLoader=defaultTestLoader, exit=True,
verbosity=1):
- if testRunner is None:
- testRunner = TextTestRunner
if isinstance(module, basestring):
self.module = __import__(module)
for part in module.split('.')[1:]:
@@ -1734,6 +1732,8 @@
self.test = loader.discover(start_dir, pattern, top_level_dir)
def runTests(self):
+ if self.testRunner is None:
+ self.testRunner = TextTestRunner
if isinstance(self.testRunner, (type, types.ClassType)):
try:
testRunner = self.testRunner(verbosity=self.verbosity)
More information about the Python-checkins
mailing list