ci: silence benign Windows asyncio cleanup warning in pytest#48
Open
ChenglongWang wants to merge 1 commit into
Open
ci: silence benign Windows asyncio cleanup warning in pytest#48ChenglongWang wants to merge 1 commit into
ChenglongWang wants to merge 1 commit into
Conversation
CPython's ProactorEventLoop on Windows finalizes subprocess transports after
the event loop has closed, which raises RuntimeError("Event loop is closed")
inside BaseSubprocessTransport.__del__. Pytest's unraisablehook converts that
into a PytestUnraisableExceptionWarning, and GitHub Actions then misannotates
the warning text as an Error in the CI summary even though every test passes.
Add a scoped filterwarnings rule under [tool.pytest.ini_options] to ignore
exactly that warning class+message. Other unraisable exceptions still surface.
Made-with: Cursor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
CI on Windows surfaces a benign
RuntimeError: Event loop is closedfrom CPython'sProactorEventLoopfinalizing subprocess transports after the loop has closed. Pytest's unraisablehook turns it into aPytestUnraisableExceptionWarning, and GitHub Actions then misannotates the warning text (which contains the substringError:) as a red error in the run summary — even though every test passes (conclusion: success).This adds a single, narrowly-scoped
filterwarningsentry under[tool.pytest.ini_options]that ignores only that exact warning class + message. Any other unraisable exception (real bugs) still surfaces normally.Verified locally: pre-filter the full suite reports
52 warnings, post-filter51 warnings(the unraisable one is gone, noBaseSubprocessTransport/Event loop is closedlines appear in the warnings summary).Test plan
pytest tests --no-cov: 1709 passed, 1 skipped (locally on macOS)