Skip to content

Commit a9cd99c

Browse files
andrewleechpi-anl
authored andcommitted
unittest: Allow passing module name or instance into unittest.main()
1 parent d64557a commit a9cd99c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

python-stdlib/unittest/unittest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def test_cases(m):
219219
if isinstance(c, object) and isinstance(c, type) and issubclass(c, TestCase):
220220
yield c
221221

222-
m = __import__(module)
222+
m = __import__(module) if isinstance(module, str) else module
223223
suite = TestSuite()
224224
for c in test_cases(m):
225225
suite.addTest(c)

0 commit comments

Comments
 (0)