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

This commit is contained in:
Pablo Galindo Salgado 2025-01-22 12:25:42 +00:00 committed by GitHub
parent 9012fa741d
commit a9f5edbf5f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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