summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGiampaolo Rodola <g.rodola@gmail.com>2020-05-04 01:57:49 +0200
committerGiampaolo Rodola <g.rodola@gmail.com>2020-05-04 01:57:49 +0200
commitb4a308c2f30164f916f06e4e85a906f48dcae11e (patch)
tree0c11fc4902fb013a6caa2c22b9831acf956a1b5b
parent6d18501e49085c6471a94acf7d960b6e07fd1148 (diff)
downloadpsutil-b4a308c2f30164f916f06e4e85a906f48dcae11e.tar.gz
fix tests
-rw-r--r--psutil/tests/__init__.py5
-rwxr-xr-xpsutil/tests/test_contracts.py9
2 files changed, 10 insertions, 4 deletions
diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py
index b8f329fd..431d3045 100644
--- a/psutil/tests/__init__.py
+++ b/psutil/tests/__init__.py
@@ -840,6 +840,11 @@ class TestCase(unittest.TestCase):
if not hasattr(unittest.TestCase, 'assertRaisesRegex'):
assertRaisesRegex = unittest.TestCase.assertRaisesRegexp
+ # ...otherwise multiprocessing.Pool complains
+ if not PY3:
+ def runTest(self):
+ pass
+
# monkey patch default unittest.TestCase
unittest.TestCase = TestCase
diff --git a/psutil/tests/test_contracts.py b/psutil/tests/test_contracts.py
index 0676bb9a..edeb1d9a 100755
--- a/psutil/tests/test_contracts.py
+++ b/psutil/tests/test_contracts.py
@@ -347,10 +347,11 @@ def proc_info(pid):
assert exc.msg
def do_wait():
- try:
- proc.wait(0)
- except psutil.Error as exc:
- check_exception(exc, proc, name, ppid)
+ if pid != 0:
+ try:
+ proc.wait(0)
+ except psutil.Error as exc:
+ check_exception(exc, proc, name, ppid)
try:
proc = psutil.Process(pid)