fix(tests): use asyncio.run in integration reachability fixtures - #160
Merged
Conversation
`asyncio.get_event_loop()` raises `RuntimeError: There is no current event loop` under Python 3.12, so the integration reachability fixtures (pg / redis / qdrant / minio / weaviate / elasticsearch) errored at setup instead of skipping when the Docker backends aren't running — breaking a full-suite run (`pytest tests packages apps/gateway`) at collection. Switch each probe to `asyncio.run(...)`, which manages its own loop, so the fixtures skip cleanly when a backend is unreachable. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
The integration reachability fixtures in
tests/integration/conftest.pyusedasyncio.get_event_loop().run_until_complete(...), which raisesRuntimeError: There is no current event loop in thread 'MainThread'under Python 3.12 + the current pytest-asyncio. As a result, a full-suite run (pytest tests packages apps/gateway) errored at collection oftests/integration/test_pg_corpus_store.pyinstead of skipping when the Docker backends aren't up.Switched each probe (pg / redis / qdrant / minio / weaviate / elasticsearch) to
asyncio.run(...), which manages its own event loop, so the fixturespytest.skipcleanly when a backend is unreachable.Test plan
uv run pytest tests/integration -qwith no Docker backends → all integration tests skip (previously errored at setup)ruff check tests/integration/conftest.py🤖 Generated with Claude Code