diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2021-10-05 00:05:57 +0200 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2021-10-05 00:05:57 +0200 |
commit | 71e56f7141caa8cc451be23998d250c62b58f5a1 (patch) | |
tree | d904580fdf24330829ba691fea8b0d0721ca310d | |
parent | 46042187f58635598c8d7c7a771d131fc4e84ace (diff) | |
download | psutil-71e56f7141caa8cc451be23998d250c62b58f5a1.tar.gz |
use ThreadTask as a ctx manager
Signed-off-by: Giampaolo Rodola <g.rodola@gmail.com>
-rwxr-xr-x | psutil/tests/test_linux.py | 6 |
1 files changed, 1 insertions, 5 deletions
diff --git a/psutil/tests/test_linux.py b/psutil/tests/test_linux.py index f5243c2c..23f6b221 100755 --- a/psutil/tests/test_linux.py +++ b/psutil/tests/test_linux.py @@ -1428,9 +1428,7 @@ class TestMisc(PsutilTestCase): # - 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) @@ -1439,8 +1437,6 @@ class TestMisc(PsutilTestCase): 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. |