diff --git a/psutil/tests/__init__.py b/psutil/tests/__init__.py index 336e17644..4d8e35583 100644 --- a/psutil/tests/__init__.py +++ b/psutil/tests/__init__.py @@ -757,6 +757,8 @@ def wait_for_pid(pid): """Wait for pid to show up in the process list then return. Used in the test suite to give time the sub process to initialize. """ + if pid not in psutil.pids(): + raise psutil.NoSuchProcess(pid) psutil.Process(pid) if WINDOWS: # give it some more time to allow better initialization @@ -950,7 +952,6 @@ class PsutilTestCase(TestCase): """ def get_testfn(self, suffix="", dir=None): - suffix += "-" + self.id() # add the test name fname = get_testfn(suffix=suffix, dir=dir) self.addCleanup(safe_rmpath, fname) return fname diff --git a/psutil/tests/test_process.py b/psutil/tests/test_process.py index fdd90dcbe..b37944a87 100755 --- a/psutil/tests/test_process.py +++ b/psutil/tests/test_process.py @@ -762,7 +762,7 @@ def test_long_cmdline(self): self.assertEqual(p.cmdline(), cmdline) def test_name(self): - p = self.spawn_psproc(PYTHON_EXE) + p = self.spawn_psproc() name = p.name().lower() pyexe = os.path.basename(os.path.realpath(sys.executable)).lower() assert pyexe.startswith(name), (pyexe, name) diff --git a/psutil/tests/test_unicode.py b/psutil/tests/test_unicode.py index aeac62ce5..ab06cebed 100755 --- a/psutil/tests/test_unicode.py +++ b/psutil/tests/test_unicode.py @@ -224,9 +224,7 @@ def test_proc_cmdline(self): for part in cmdline: self.assertIsInstance(part, str) if self.expect_exact_path_match(): - self.assertEqual( - cmdline, [self.funky_name, "-c", "time.sleep(10)"] - ) + self.assertEqual(cmdline, cmd) def test_proc_cwd(self): dname = self.funky_name + "2"