From: Pablo Galindo Salgado Date: Wed, 22 Jan 2025 12:25:42 +0000 (+0000) Subject: gh-129158: Ensure we restore unix_events.can_use_pidfd after SubprocessThreadedWatche... X-Git-Tag: v3.14.0a5~295 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=a9f5edbf5fb141ad172978b25483342125184ed2;p=thirdparty%2FPython%2Fcpython.git gh-129158: Ensure we restore unix_events.can_use_pidfd after SubprocessThreadedWatcherTests finishes (#129160) --- diff --git a/Lib/test/test_asyncio/test_subprocess.py b/Lib/test/test_asyncio/test_subprocess.py index 57decaf2d277..a053db8e6d76 100644 --- a/Lib/test/test_asyncio/test_subprocess.py +++ b/Lib/test/test_asyncio/test_subprocess.py @@ -901,9 +901,14 @@ if sys.platform != 'win32': 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(),