Skip to content

asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd #103780

Closed
@itamaro

Description

@itamaro

Bug report

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).

Your environment

  • CPython versions tested on: main
  • Operating system and architecture: MacOS x86-64

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy