diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-22 03:26:22 -0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-22 03:26:22 -0800 |
commit | 209c0bda4d2bcebf05c3a62451f19a2c5851083a (patch) | |
tree | c28e8e7c6ae29b56b21417181306b37054fee03f | |
parent | a7f04e6972c68a775e20da912d8cfd15bfe8803c (diff) | |
download | psutil-209c0bda4d2bcebf05c3a62451f19a2c5851083a.tar.gz |
fix failing test on windows
-rw-r--r-- | test/test_psutil.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/test/test_psutil.py b/test/test_psutil.py index 731aebca..1e3d40d3 100644 --- a/test/test_psutil.py +++ b/test/test_psutil.py @@ -164,7 +164,10 @@ def get_test_subprocess(cmd=None, wait=False, **kwds): pyline = "" if wait: pyline += "open(r'%s', 'w'); " % TESTFN - pyline += "import time; time.sleep(60);" + # A process living for 30 secs. We sleep N times (as opposed to + # once) in order to be nicer towards Windows which doesn't handle + # interrupt signals properly. + pyline += "import time; [time.sleep(0.01) for x in range(3000)];" cmd_ = [PYTHON, "-c", pyline] else: cmd_ = cmd @@ -2287,8 +2290,8 @@ class TestProcess(unittest.TestCase): p = psutil.Process(sproc.pid) p.terminate() p.wait() - # if WINDOWS: - # wait_for_pid(p.pid) + if WINDOWS: + call_until(psutil.pids, "%s not in ret" % p.pid) self.assertFalse(p.is_running()) # self.assertFalse(p.pid in psutil.pids(), msg="retcode = %s" % # retcode) |