fix test type handling (#123)

This commit is contained in:
Dirk Thomas 2016-09-19 09:04:30 -07:00
parent 69ec1cd9a7
commit 2736a11ad9
1 changed files with 4 additions and 3 deletions

View File

@ -87,10 +87,11 @@ def unitrun(package, test_name, test, sysargs=None, coverage_packages=None):
# create and run unittest suite with our xmllrunner wrapper
suite = None
if isinstance(test, unittest.TestCase):
suite = unittest.TestLoader().loadTestsFromTestCase(test)
else:
if isinstance(test, str):
suite = unittest.TestLoader().loadTestsFromName(test)
else:
# some callers pass a TestCase type (instead of an instance)
suite = unittest.TestLoader().loadTestsFromTestCase(test)
if text_mode:
result = unittest.TextTestRunner(verbosity=2).run(suite)