Skip to content

PytestDeprecationWarning: The configuration option "asyncio_default_fixture_loop_scope" is unset. #4778

@JC-wk

Description

@JC-wk

Describe the bug
/usr/local/lib/python3.12/site-packages/pytest_asyncio/plugin.py:208: 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. Set the default fixture loop scope explicitly in order to avoid unexpected behavior in the future. Valid fixture loop scopes are: "function", "class", "module", "package", "session"

warnings.warn(PytestDeprecationWarning(_DEFAULT_FIXTURE_LOOP_SCOPE_UNSET))

Steps to reproduce

  1. run Pytest
  2. observe warning

Azure TRE release version (e.g. v0.14.0 or main):
main

Solution
add asyncio_default_fixture_loop_scope and asyncio_mode to api_app/pytest.ini, this is already present in /workspaces/AxymTRE/e2e_tests/pytest.ini

# Ensure pytest-asyncio has an explicit event loop scope to avoid deprecation warnings
asyncio_mode = auto
asyncio_default_fixture_loop_scope = function

see pytest-dev/pytest-asyncio#924

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions