From 3212d4f6e47f84ea7e7b8073e8bd8b53febbc017 Mon Sep 17 00:00:00 2001 From: mikemolinet Date: Wed, 6 May 2026 11:56:23 -0700 Subject: [PATCH] chore(test): pin asyncio_default_fixture_loop_scope to function MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- pytest.ini | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pytest.ini b/pytest.ini index 2f4c80e..64b048b 100644 --- a/pytest.ini +++ b/pytest.ini @@ -1,2 +1,11 @@ [pytest] asyncio_mode = auto +# pytest-asyncio 1.x changed the default fixture loop scope. With it +# unset, pytest-asyncio 1.x emits a deprecation warning and the +# session-scoped fixtures bind to a different event loop than the +# per-test functions, producing "another operation is in progress" +# (asyncpg) and "attached to a different loop" (asyncio) errors. +# Pinning the scope explicitly keeps pytest-asyncio 0.24.x and 1.x +# behaviorally identical and unblocks the Dependabot pytest-asyncio +# 1.3.0 bump (#40). +asyncio_default_fixture_loop_scope = function