Fix Studio Tests CI: async event loop error in backend auth tests#39
Merged
Conversation
Convert sync client fixture to async fixture, use pytest-asyncio auto mode, and properly manage AsyncClient lifecycle with async context manager.
Copilot created this pull request from a session on behalf of
AlanFokCo
May 28, 2026 11:36
View session
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.
Studio Tests / Backend failing on both Python 3.10 and 3.11 with
RuntimeError: There is no current event loop in thread 'MainThread'— all 4TestAuthEndpointstests erroring out.Root cause: the
clientfixture usedasyncio.get_event_loop().run_until_complete()to set up the DB, which has been broken since Python 3.10 deprecated implicit event loop creation.Changes
web_strategy_studio/backend/tests/test_auth.py— Convertclientfrom a sync fixture to an async fixture; replaceget_event_loop().run_until_complete()with directawait; useasync with AsyncClient(...)for proper lifecycle; dispose engine after yieldweb_strategy_studio/backend/pyproject.toml— Addasyncio_mode = "auto"to pytest config so async fixtures are handled without per-fixture decorationAll 141 backend tests pass.