Move initialising unittest.TestProgram.testRunner into runTests. Issue 6418.

This commit is contained in:
Michael Foord 2009-07-13 16:32:47 +00:00
parent f4a96e07d8
commit bee87b4c1c
2 changed files with 5 additions and 12 deletions

View file

@ -800,8 +800,6 @@ Examples:
def __init__(self, module='__main__', defaultTest=None,
argv=None, testRunner=None,
testLoader=defaultTestLoader):
if testRunner is None:
testRunner = TextTestRunner
if type(module) == type(''):
self.module = __import__(module)
for part in module.split('.')[1:]:
@ -851,6 +849,9 @@ Examples:
self.module)
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)