GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd · Issue #103780 · python/cpython

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

New issue
Copy link
New issue
Copy link
Closed
#103782
Closed
asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd#103780
#103782
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

Description

@itamaro
itamaro
opened on Apr 24, 2023
Issue body actions

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

  • gh-103780: Use patch instead of mock in asyncio unix events test #103782

Activity

  1. itamaro
    added
    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
    on Apr 24, 2023
  2. itamaro
    added a commit that references this issue on Apr 24, 2023

    pythongh-103780: Use patch instead of mock in asyncio unix events test

    a76f2e2
  3. carljm
    closed this as completedin #103782on Apr 24, 2023
  4. carljm
    added 3 commits that reference this issue on Apr 24, 2023

    gh-103780: Use patch instead of mock in asyncio unix events test (#10…

    518050c

    Merge branch 'main' into superopt

    0de5bc6

    Merge branch 'superopt' into superopt_spec

    1972ca4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402503 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.