diff options
| author | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-31 17:54:52 +0100 |
|---|---|---|
| committer | Giampaolo Rodola <g.rodola@gmail.com> | 2016-01-31 17:54:52 +0100 |
| commit | 75520ea96286f2c8683294ecab72298fc159be34 (patch) | |
| tree | 02c40b07488d3ada82059b12583cf8c65846dd1b | |
| parent | 212e1c9a3a5c3df272ab6751f7ac720e5c1fe770 (diff) | |
| download | psutil-75520ea96286f2c8683294ecab72298fc159be34.tar.gz | |
try to prevent occasional failure on windows
| -rw-r--r-- | psutil/__init__.py | 13 | ||||
| -rw-r--r-- | test/test_psutil.py | 9 |
2 files changed, 11 insertions, 11 deletions
diff --git a/psutil/__init__.py b/psutil/__init__.py index c034ad6f..e8c64087 100644 --- a/psutil/__init__.py +++ b/psutil/__init__.py @@ -245,13 +245,12 @@ class ZombieProcess(NoSuchProcess): self.name = name self.msg = msg if msg is None: - if name and ppid: - details = "(pid=%s, name=%s, ppid=%s)" % ( - self.pid, repr(self.name), self.ppid) - elif name: - details = "(pid=%s, name=%s)" % (self.pid, repr(self.name)) - else: - details = "(pid=%s)" % self.pid + args = ["pid=%s" % pid] + if name: + args.append("name=%s" % repr(self.name)) + if ppid: + args.append("ppid=%s" % self.ppid) + details = "(%s)" % ", ".join(args) self.msg = "process still exists but it's a zombie " + details diff --git a/test/test_psutil.py b/test/test_psutil.py index a1dcd082..356d7e87 100644 --- a/test/test_psutil.py +++ b/test/test_psutil.py @@ -1795,11 +1795,12 @@ class TestProcess(unittest.TestCase): sproc = get_test_subprocess(cmdline) p = psutil.Process(sproc.pid) # ...in order to try to prevent occasional failures on travis - wait_for_pid(p.pid) - normcase = os.path.normcase - self.assertEqual(p.name(), os.path.basename(funky_path)) - self.assertEqual(normcase(p.exe()), normcase(funky_path)) + if TRAVIS: + wait_for_pid(p.pid) self.assertEqual(p.cmdline(), cmdline) + self.assertEqual(p.name(), os.path.basename(funky_path)) + self.assertEqual(os.path.normcase(p.exe()), + os.path.normcase(funky_path)) @unittest.skipUnless(POSIX, 'posix only') def test_uids(self): |
