Skip to content

Commit

Permalink
use ThreadTask as a ctx manager
Browse files Browse the repository at this point in the history
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
  • Loading branch information
giampaolo committed Oct 4, 2021
1 parent 4604218 commit 71e56f7
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions psutil/tests/test_linux.py
Original file line number Diff line number Diff line change
Expand Up @@ -1428,9 +1428,7 @@ def test_issue_687(self):
# - Process(tid) is supposed to work
# - pids() should not return the TID
# See: https://github.com/giampaolo/psutil/issues/687
t = ThreadTask()
t.start()
try:
with ThreadTask():
p = psutil.Process()
threads = p.threads()
self.assertEqual(len(threads), 2)
Expand All @@ -1439,8 +1437,6 @@ def test_issue_687(self):
pt = psutil.Process(tid)
pt.as_dict()
self.assertNotIn(tid, psutil.pids())
finally:
t.stop()

def test_pid_exists_no_proc_status(self):
# Internally pid_exists relies on /proc/{pid}/status.
Expand Down

0 comments on commit 71e56f7

Please sign in to comment.