Fix pytest asyncio deprecation warning - #5055
Open
James Chapman (JC-wk) wants to merge 6 commits into
Open
Conversation
Unit Test Results755 tests 755 ✅ 9s ⏱️ Results for commit 473bb15. ♻️ This comment has been updated with latest results. |
Contributor
There was a problem hiding this comment.
Pull request overview
Configures pytest-asyncio explicitly to eliminate deprecation warnings and support strict mode.
Changes:
- Sets function-scoped event loops and strict asyncio mode.
- Corrects synchronous fixtures to use
pytest.fixture.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
pyproject.toml |
Adds root pytest-asyncio configuration. |
api_app/pytest.ini |
Adds API-specific asyncio configuration. |
api_app/tests_ma/test_api/conftest.py |
Corrects the synchronous app fixture decorator. |
api_app/tests_ma/test_api/test_routes/test_airlock.py |
Corrects synchronous fixture decorators. |
💡 Add a code-review agent skill for context-aware, tailored reviews. Learn more in the docs.
Sven Aelterman (SvenAelterman)
approved these changes
Aug 25, 2026
Sven Aelterman (SvenAelterman)
left a comment
Collaborator
There was a problem hiding this comment.
LGTM
Collaborator
|
/test 473bb15 |
|
🤖 pr-bot 🤖 🏃 Running tests: https://github.com/microsoft/AzureTRE/actions/runs/32888275123 (with refid (in response to this comment from Jack Morris (@rudolphjacksonm)) |
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.
Resolves #4778
Summary
This PR fixes a pytest-asyncio deprecation warning by explicitly configuring the asyncio mode and default event loop scope for test fixtures.
Details
when
pytest --ignore e2e_testsis ran from the root (as documented) Pytest emits aPytestDeprecationWarningindicating that the configuration optionasyncio_default_fixture_loop_scopeis unset. With newer versions ofpytest-asyncio(>= 1.3.0), this will become an error unless explicitly configured.How is this addressed
asyncio_default_fixture_loop_scope = functioninpyproject.tomlAll tests pass locally under
pytest-asyncio >= 1.24.0.