mirror of
https://github.com/python/cpython.git
synced 2025-08-29 21:25:01 +00:00
run_unittest() to support TestCase instances as well as classes. Helps with doctests.
This commit is contained in:
parent
5f4e8ca376
commit
21d9987cb5
1 changed files with 4 additions and 1 deletions
|
@ -251,7 +251,10 @@ def run_unittest(*classes):
|
|||
"""Run tests from unittest.TestCase-derived classes."""
|
||||
suite = unittest.TestSuite()
|
||||
for cls in classes:
|
||||
suite.addTest(unittest.makeSuite(cls))
|
||||
if isinstance(cls, unittest.TestCase):
|
||||
suite.addTest(cls)
|
||||
else:
|
||||
suite.addTest(unittest.makeSuite(cls))
|
||||
if len(classes)==1:
|
||||
testclass = classes[0]
|
||||
else:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue