Restore default testRunner argument in unittest.main to None. Issue 6177.
This commit is contained in:
parent
05f26d88fd
commit
48bc8203cc
|
@ -2284,6 +2284,17 @@ class Test_Assertions(TestCase):
|
||||||
self.assertRaises(AssertionError,
|
self.assertRaises(AssertionError,
|
||||||
self.failIfAlmostEqual, 0, .1+.1j, places=0)
|
self.failIfAlmostEqual, 0, .1+.1j, places=0)
|
||||||
|
|
||||||
|
|
||||||
|
class Test_TestProgram(TestCase):
|
||||||
|
|
||||||
|
def testTestProgram_testRunnerArgument(self):
|
||||||
|
program = object.__new__(unittest.TestProgram)
|
||||||
|
program.parseArgs = lambda _: None
|
||||||
|
program.runTests = lambda: None
|
||||||
|
program.__init__(testRunner=None)
|
||||||
|
self.assertEqual(program.testRunner, unittest.TextTestRunner)
|
||||||
|
|
||||||
|
|
||||||
######################################################################
|
######################################################################
|
||||||
## Main
|
## Main
|
||||||
######################################################################
|
######################################################################
|
||||||
|
@ -2291,7 +2302,7 @@ class Test_Assertions(TestCase):
|
||||||
def test_main():
|
def test_main():
|
||||||
test_support.run_unittest(Test_TestCase, Test_TestLoader,
|
test_support.run_unittest(Test_TestCase, Test_TestLoader,
|
||||||
Test_TestSuite, Test_TestResult, Test_FunctionTestCase,
|
Test_TestSuite, Test_TestResult, Test_FunctionTestCase,
|
||||||
Test_Assertions)
|
Test_Assertions, Test_TestProgram)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
test_main()
|
test_main()
|
||||||
|
|
|
@ -798,8 +798,10 @@ Examples:
|
||||||
in MyTestCase
|
in MyTestCase
|
||||||
"""
|
"""
|
||||||
def __init__(self, module='__main__', defaultTest=None,
|
def __init__(self, module='__main__', defaultTest=None,
|
||||||
argv=None, testRunner=TextTestRunner,
|
argv=None, testRunner=None,
|
||||||
testLoader=defaultTestLoader):
|
testLoader=defaultTestLoader):
|
||||||
|
if testRunner is None:
|
||||||
|
testRunner = TextTestRunner
|
||||||
if type(module) == type(''):
|
if type(module) == type(''):
|
||||||
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