mirror of
https://github.com/python/cpython.git
synced 2025-08-01 07:33:08 +00:00
unittest.TestLoader.loadTestsFromName honors the loader suiteClass attribute. Issue 6866.
This commit is contained in:
parent
ee2df03009
commit
5a9719d627
3 changed files with 46 additions and 2 deletions
|
@ -85,7 +85,7 @@ class TestLoader(object):
|
|||
elif (isinstance(obj, types.UnboundMethodType) and
|
||||
isinstance(parent, type) and
|
||||
issubclass(parent, case.TestCase)):
|
||||
return suite.TestSuite([parent(obj.__name__)])
|
||||
return self.suiteClass([parent(obj.__name__)])
|
||||
elif isinstance(obj, suite.TestSuite):
|
||||
return obj
|
||||
elif hasattr(obj, '__call__'):
|
||||
|
@ -93,7 +93,7 @@ class TestLoader(object):
|
|||
if isinstance(test, suite.TestSuite):
|
||||
return test
|
||||
elif isinstance(test, case.TestCase):
|
||||
return suite.TestSuite([test])
|
||||
return self.suiteClass([test])
|
||||
else:
|
||||
raise TypeError("calling %s returned %s, not a test" %
|
||||
(obj, test))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue