Skip to content

Commit a9f5edb

Browse files
authored
gh-129158: Ensure we restore unix_events.can_use_pidfd after SubprocessThreadedWatcherTests finishes (#129160)
1 parent 9012fa7 commit a9f5edb

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Lib/test/test_asyncio/test_subprocess.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -901,9 +901,14 @@ def test_watcher_implementation(self):
901901
class SubprocessThreadedWatcherTests(SubprocessWatcherMixin,
902902
test_utils.TestCase):
903903
def setUp(self):
904+
self._original_can_use_pidfd = unix_events.can_use_pidfd
904905
# Force the use of the threaded child watcher
905906
unix_events.can_use_pidfd = mock.Mock(return_value=False)
906907
super().setUp()
908+
909+
def tearDown(self):
910+
unix_events.can_use_pidfd = self._original_can_use_pidfd
911+
return super().tearDown()
907912

908913
@unittest.skipUnless(
909914
unix_events.can_use_pidfd(),

0 commit comments

Comments
 (0)