https://github.com/python/cpython/commit/a9f5edbf5fb141ad172978b25483342125184ed2
commit: a9f5edbf5fb141ad172978b25483342125184ed2
branch: main
author: Pablo Galindo Salgado <[email protected]>
committer: pablogsal <[email protected]>
date: 2025-01-22T12:25:42Z
summary:

gh-129158: Ensure we restore unix_events.can_use_pidfd after 
SubprocessThreadedWatcherTests finishes (#129160)

files:
M Lib/test/test_asyncio/test_subprocess.py

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(),

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to