Skip to content

Commit

Permalink
fix failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
giampaolo committed Jan 13, 2024
1 parent 86f171a commit 2d880c8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 9 deletions.
3 changes: 0 additions & 3 deletions psutil/tests/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -760,9 +760,6 @@ def wait_for_pid(pid):
if pid not in psutil.pids():
raise psutil.NoSuchProcess(pid)
psutil.Process(pid)
if WINDOWS:
# give it some more time to allow better initialization
time.sleep(0.01)


@retry(
Expand Down
6 changes: 3 additions & 3 deletions psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -749,7 +749,7 @@ def test_cmdline(self):
def test_long_cmdline(self):
cmdline = [PYTHON_EXE]
cmdline.extend(["-v"] * 50)
cmdline.extend(["-c", "time.sleep(10)"])
cmdline.extend(["-c", "import time; time.sleep(10)"])
p = self.spawn_psproc(cmdline)
if OPENBSD:
# XXX: for some reason the test process may turn into a
Expand All @@ -770,7 +770,7 @@ def test_name(self):
@unittest.skipIf(PYPY, "unreliable on PYPY")
def test_long_name(self):
pyexe = create_py_exe(self.get_testfn(suffix="0123456789" * 2))
cmdline = [pyexe, "-c", "time.sleep(10)"]
cmdline = [pyexe, "-c", "import time; time.sleep(10)"]
p = self.spawn_psproc(cmdline)
if OPENBSD:
# XXX: for some reason the test process may turn into a
Expand Down Expand Up @@ -799,7 +799,7 @@ def test_prog_w_funky_name(self):
# with funky chars such as spaces and ")", see:
# https://github.com/giampaolo/psutil/issues/628
pyexe = create_py_exe(self.get_testfn(suffix='foo bar )'))
cmdline = [pyexe, "-c", "time.sleep(10)"]
cmdline = [pyexe, "-c", "import time; time.sleep(10)"]
p = self.spawn_psproc(cmdline)
self.assertEqual(p.cmdline(), cmdline)
self.assertEqual(p.name(), os.path.basename(pyexe))
Expand Down
6 changes: 3 additions & 3 deletions psutil/tests/test_unicode.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ def expect_exact_path_match(self):
# ---

def test_proc_exe(self):
cmd = [self.funky_name, "-c", "time.sleep(10)"]
cmd = [self.funky_name, "-c", "import time; time.sleep(10)"]
subp = self.spawn_testproc(cmd)
p = psutil.Process(subp.pid)
exe = p.exe()
Expand All @@ -209,15 +209,15 @@ def test_proc_exe(self):
)

def test_proc_name(self):
cmd = [self.funky_name, "-c", "time.sleep(10)"]
cmd = [self.funky_name, "-c", "import time; time.sleep(10)"]
subp = self.spawn_testproc(cmd)
name = psutil.Process(subp.pid).name()
self.assertIsInstance(name, str)
if self.expect_exact_path_match():
self.assertEqual(name, os.path.basename(self.funky_name))

def test_proc_cmdline(self):
cmd = [self.funky_name, "-c", "time.sleep(10)"]
cmd = [self.funky_name, "-c", "import time; time.sleep(10)"]
subp = self.spawn_testproc(cmd)
p = psutil.Process(subp.pid)
cmdline = p.cmdline()
Expand Down

0 comments on commit 2d880c8

Please sign in to comment.