From 6a08587bd406880ca6d68262a399032ff5974782 Mon Sep 17 00:00:00 2001 From: Pablo Galindo Date: Tue, 21 Jan 2025 23:16:28 +0000 Subject: [PATCH] gh-129158: Ensure we restore unix_events.can_use_pidfd after SubprocessThreadedWatcherTests finishes --- Lib/test/test_asyncio/test_subprocess.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 57decaf2d277fb..a053db8e6d76f2 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -901,9 +901,14 @@ def test_watcher_implementation(self): class SubprocessThreadedWatcherTests(SubprocessWatcherMixin, test_utils.TestCase): def setUp(self): + self._original_can_use_pidfd = unix_events.can_use_pidfd # Force the use of the threaded child watcher unix_events.can_use_pidfd = mock.Mock(return_value=False) super().setUp() + + def tearDown(self): + unix_events.can_use_pidfd = self._original_can_use_pidfd + return super().tearDown() @unittest.skipUnless( unix_events.can_use_pidfd(),