Title: asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd · Issue #103780 · python/cpython · GitHub
Open Graph Title: asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd · Issue #103780 · python/cpython
X Title: asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd · Issue #103780 · python/cpython
Description: 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...
Open Graph Description: 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 do...
X Description: 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 do...
Opengraph URL: https://github.com/python/cpython/issues/103780
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"asyncio unix events test doesn't restore mocked unix_events.can_use_pidfd","articleBody":"# Bug report\r\n\r\nin `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.\r\n\r\nthis 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).\r\n\r\nrepro:\r\n\r\n```\r\n./python.exe -m test test_asyncio -m '*.test_unix_events.*' -R 2:2\r\nWARNING: Running tests with --huntrleaks/-R and less than 3 warmup repetitions can give false positives!\r\n0:00:00 load avg: 3.79 Run tests sequentially\r\n0:00:00 load avg: 3.79 [1/1] test_asyncio\r\nbeginning 4 repetitions\r\n1234\r\n.Process ForkProcess-10:\r\nTraceback (most recent call last):\r\n...\r\n...\r\nAttributeError: module 'os' has no attribute 'pidfd_open'\r\n...\r\n...\r\n```\r\n\r\nthis can be fixed by patching instead of mocking in the `test_get_default_child_watcher` test (PR coming up).\r\n\r\n# Your environment\r\n\r\n- CPython versions tested on: main\r\n- Operating system and architecture: MacOS x86-64\r\n\n\n\u003c!-- gh-linked-prs --\u003e\n### Linked PRs\n* gh-103782\n\u003c!-- /gh-linked-prs --\u003e\n","author":{"url":"https://github.com/itamaro","@type":"Person","name":"itamaro"},"datePublished":"2023-04-24T18:28:56.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/103780/cpython/issues/103780"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:2cf6ea46-0203-1745-18b4-8bc19201bbb3 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B180:9DE01:6F47F8:970E61:6969DA26 |
| html-safe-nonce | 8bd7ee8966ad8fb8916479f5fd1cb63cc8562d7a4fc2baf26b5f34264325cef8 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCMTgwOjlERTAxOjZGNDdGODo5NzBFNjE6Njk2OURBMjYiLCJ2aXNpdG9yX2lkIjoiNzkyMDM0Njc5MDQyNzcwMzAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | edc871021d48ddfa3ac392ce5df52e466b5ce26fb3f50a0728401c0d6b721370 |
| hovercard-subject-tag | issue:1681810349 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/python/cpython/103780/issue_layout |
| twitter:image | https://opengraph.githubassets.com/c9d932e9a116d714736d10e2933f015b19b0ae2fa772d2c2f8ced6598b85c20c/python/cpython/issues/103780 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/c9d932e9a116d714736d10e2933f015b19b0ae2fa772d2c2f8ced6598b85c20c/python/cpython/issues/103780 |
| og:image:alt | 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 do... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | itamaro |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7b32f1c7c4549428ee399213e8345494fc55b5637195d3fc5f493657579235e8 |
| turbo-cache-control | no-preview |
| go-import | github.com/python/cpython git https://github.com/python/cpython.git |
| octolytics-dimension-user_id | 1525981 |
| octolytics-dimension-user_login | python |
| octolytics-dimension-repository_id | 81598961 |
| octolytics-dimension-repository_nwo | python/cpython |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 81598961 |
| octolytics-dimension-repository_network_root_nwo | python/cpython |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | bdde15ad1b403e23b08bbd89b53fbe6bdf688cad |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width