Skip to content

Commit

Permalink
Merge pull request #1618 from mulkieran/master-psutil
Browse files Browse the repository at this point in the history
In assertion, guard against the possibility of ephemeral processes
  • Loading branch information
mulkieran authored Aug 23, 2019
2 parents 4e4f8ff + 0156caf commit 8f27bf5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions tests/client-dbus/tests/dbus/_misc.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,9 +82,13 @@ def setUpClass(cls):
"""
Assert that there are no other stratisd processes running.
"""
assert not any(
psutil.Process(p).name() == "stratisd" for p in psutil.pids()
), "Evidently a stratisd process is already running."
for pid in psutil.pids():
try:
assert psutil.Process(pid).name() != "stratisd", (
"Evidently a stratisd process with process id %u is running" % pid
)
except psutil.NoSuchProcess:
pass

def setUp(self):
"""
Expand Down

0 comments on commit 8f27bf5

Please sign in to comment.