chore(test): pin asyncio_default_fixture_loop_scope to function#51
Closed
mikemolinet wants to merge 6 commits into
Closed
chore(test): pin asyncio_default_fixture_loop_scope to function#51mikemolinet wants to merge 6 commits into
mikemolinet wants to merge 6 commits into
Conversation
pytest-asyncio 1.x changed the default fixture loop scope. With the scope unset (current state), pytest-asyncio 1.x emits a deprecation warning AND session-scoped fixtures bind to a different event loop than the per-test functions, which produces: * asyncpg.exceptions._base.InterfaceError: cannot perform operation: another operation is in progress * RuntimeError: ... got Future ... attached to a different loop Empirically reproduced on Dependabot PR #40 (pytest-asyncio 0.24.0 → 1.3.0): every test except the first one in the session ERRORs. Pinning the scope explicitly to ``function`` keeps pytest-asyncio 0.24.x and 1.x behaviorally identical and unblocks the bump. Per CC-cue-pm-pr-watcher PMW-NUDGE 2026-05-06: 11 Dependabot PRs were stuck on a separate token-secret bug (now fixed via Item 5 fan). This pytest-asyncio change was the only remaining real (non-plumbing) failure that blocks #40 from auto-merging once sentinel-rebase pulls this fix in. #38 (pytest 8.3.0 → 9.0.3) is dep-chained behind #40: pytest-asyncio 0.24.0 caps pytest<9, so pytest 9.0.3 can only land after #40 merges and pytest-asyncio bumps to 1.3.0 (which supports pytest>=8.2 including 9.x). This PR doesn't touch #38; it cascades naturally once #40 lands.
5 tasks
Collaborator
Author
|
Closing as stale — branch diverged from main by ~8871 deletions across 57 files. Rebase infeasible. Pin still needed: the Next step: trivial fresh PR — single line addition to Branch retained for reference. |
auto-merge was automatically disabled
May 11, 2026 15:33
Pull request was closed
3 tasks
mikemolinet
added a commit
that referenced
this pull request
May 11, 2026
Silences the deprecation warning that pytest-asyncio emits on every test run: PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset. The event loop scope for asynchronous fixtures will default to the fixture caching scope. Future versions of pytest-asyncio will default the loop scope for asynchronous fixtures to function scope. Pin the default to ``function`` explicitly. Matches the future pytest-asyncio default and silences the warning. Re-port of closed PR #51 (was on stale base ~8870 deletions behind current main). Same one-line fix; fresh against `f9ec4ea`.
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
Per cue-pm-pr-watcher PMW-NUDGE 2026-05-06: 11 Dependabot PRs were stuck on a separate token-secret bug (now fixed via Item 5 fan). Of the 2 with REAL test failures distinct from the secret bug:
cannot perform operation: another operation is in progress(asyncpg) andattached to a different loop(asyncio).pytest-asyncio==0.24.0capspytest<9. Dep-chained behind chore(deps): bump pytest-asyncio from 0.24.0 to 1.3.0 #40.Root cause
pytest-asyncio 1.x changed the default fixture loop scope. With the scope unset (current state), pytest-asyncio 1.x emits a deprecation warning AND session-scoped fixtures bind to a different event loop than the per-test functions. The first test in the session works; everything after errors.
Fix
Pin
asyncio_default_fixture_loop_scope = functionexplicitly inpytest.ini. Keeps pytest-asyncio 0.24.x and 1.x behaviorally identical so the bump can land cleanly.Cascade
Once this merges:
pytest>=8.2including 9.x) → CI passes → auto-merges.Test plan
pytest.ini. Existing tests stay deterministic.🤖 Generated with Claude Code