Skip to content

Commit

Permalink
try to prevent occasional failure on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 31, 2016
1 parent 212e1c9 commit 75520ea
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
13 changes: 6 additions & 7 deletions psutil/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,13 +245,12 @@ def __init__(self, pid, name=None, ppid=None, msg=None):
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


Expand Down
9 changes: 5 additions & 4 deletions test/test_psutil.py
Original file line number Diff line number Diff line change
Expand Up @@ -1795,11 +1795,12 @@ def test_prog_w_funky_name(self):
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):
Expand Down

0 comments on commit 75520ea

Please sign in to comment.