Skip to content

Commit

Permalink
Update test_process.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mayeut committed Jul 30, 2023
1 parent 5c067aa commit 2011527
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions psutil/tests/test_process.py
Original file line number Diff line number Diff line change
Expand Up @@ -1059,13 +1059,12 @@ def test_num_fds(self):
def test_num_ctx_switches(self):
p = psutil.Process()
before = sum(p.num_ctx_switches())
for _ in range(1000000):
time.sleep(0.05)
for _ in range(2):
time.sleep(0.05) # this shall ensure a context switch happens
after = sum(p.num_ctx_switches())
if after > before:
return
raise self.fail(
"num ctx switches still the same after 50.000 iterations")
raise self.fail("num ctx switches still the same after 2 iterations")

def test_ppid(self):
p = psutil.Process()
Expand Down

0 comments on commit 2011527

Please sign in to comment.