mirror of https://github.com/python/cpython.git
Restore default testRunner argument in unittest.main to None. Issue 6177
This commit is contained in:
parent
abb4ec6dc4
commit
dad7b7b1cb
|
@ -3325,6 +3325,14 @@ def removeTest():
|
||||||
self.assertEqual(program.verbosity, 2)
|
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):
|
class FooBar(unittest.TestCase):
|
||||||
def testPass(self):
|
def testPass(self):
|
||||||
assert True
|
assert True
|
||||||
|
|
|
@ -1640,9 +1640,11 @@ class TestProgram(object):
|
||||||
"""
|
"""
|
||||||
USAGE = USAGE
|
USAGE = USAGE
|
||||||
def __init__(self, module='__main__', defaultTest=None,
|
def __init__(self, module='__main__', defaultTest=None,
|
||||||
argv=None, testRunner=TextTestRunner,
|
argv=None, testRunner=None,
|
||||||
testLoader=defaultTestLoader, exit=True,
|
testLoader=defaultTestLoader, exit=True,
|
||||||
verbosity=1):
|
verbosity=1):
|
||||||
|
if testRunner is None:
|
||||||
|
testRunner = TextTestRunner
|
||||||
if isinstance(module, basestring):
|
if isinstance(module, basestring):
|
||||||
self.module = __import__(module)
|
self.module = __import__(module)
|
||||||
for part in module.split('.')[1:]:
|
for part in module.split('.')[1:]:
|
||||||
|
|
Loading…
Reference in New Issue