mirror of
https://github.com/python/cpython.git
synced 2025-08-30 05:35:08 +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."""
|
"""Run tests from unittest.TestCase-derived classes."""
|
||||||
suite = unittest.TestSuite()
|
suite = unittest.TestSuite()
|
||||||
for cls in classes:
|
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:
|
if len(classes)==1:
|
||||||
testclass = classes[0]
|
testclass = classes[0]
|
||||||
else:
|
else:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue