You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd #103780
in test_asyncio.test_unix_events.PolicyTest.test_get_default_child_watcher, unix_events.can_use_pidfd is mocked within the test body, but never restored to the original function.
this doesn't cause test failures during regular test runs, but during a refleak test run on MacOS it a AttributeError: module 'os' has no attribute 'pidfd_open' to be thrown (presumably due to another test using the non-mocked function in the second iteration).
repro:
./python.exe -m test test_asyncio -m '*.test_unix_events.*' -R 2:2
WARNING: Running tests with --huntrleaks/-R and less than 3 warmup repetitions can give false positives!
0:00:00 load avg: 3.79 Run tests sequentially
0:00:00 load avg: 3.79 [1/1] test_asyncio
beginning 4 repetitions
1234
.Process ForkProcess-10:
Traceback (most recent call last):
...
...
AttributeError: module 'os' has no attribute 'pidfd_open'
...
...
this can be fixed by patching instead of mocking in the test_get_default_child_watcher test (PR coming up).
Activity
pythongh-103780: Use patch instead of mock in asyncio unix events test
gh-103780: Use patch instead of mock in asyncio unix events test (#10…
Merge branch 'main' into superopt
Merge branch 'superopt' into superopt_spec