summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-05-01 18:43:16 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2020-05-01 18:43:16 +0200
commit26aebb6647b2c0f122f10bfad80bb6ede2a24985 (patch)
tree74a3eee9f6fc4c128ea67b5888e158293bbdcab1
parent13ba2222971781dc8150099d1fddefb538417ba1 (diff)
downloadpsutil-26aebb6647b2c0f122f10bfad80bb6ede2a24985.tar.gz
fix AttributeError
-rwxr-xr-xpsutil/tests/runner.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/psutil/tests/runner.py b/psutil/tests/runner.py
index 14e33fba..97139fbc 100755
--- a/psutil/tests/runner.py
+++ b/psutil/tests/runner.py
@@ -216,10 +216,16 @@ class ParallelRunner(ColouredTextRunner):
def _split_suite(suite):
serial = unittest.TestSuite()
parallel = unittest.TestSuite()
- for test in suite._tests:
+ for test in suite:
if test.countTestCases() == 0:
continue
- test_class = test._tests[0].__class__
+ elif isinstance(test, unittest.TestSuite):
+ test_class = test._tests[0].__class__
+ elif isinstance(test, unittest.TestCase):
+ test_class = test
+ else:
+ raise TypeError("can't recognize type %r" % test)
+
if getattr(test_class, '_serialrun', False):
serial.addTest(test)
else: