Skip to content

fix: only warn about unset asyncio_default_fixture_loop_scope when pytest-asyncio is used - #1635

Closed
EnesKartal wants to merge 1 commit into
pytest-dev:mainfrom
EnesKartal:fix/defer-default-fixture-loop-scope-warning
Closed

EnesKartal wants to merge 1 commit into
pytest-dev:mainfrom
EnesKartal:fix/defer-default-fixture-loop-scope-warning

Conversation

@EnesKartal

Copy link
Copy Markdown

Summary

  • Defer the PytestDeprecationWarning for unset asyncio_default_fixture_loop_scope from pytest_configure() to pytest_pyfunc_call() (for @pytest.mark.asyncio tests) and pytest_fixture_setup() (for asyncio-managed async fixtures), guarded by a config.stash flag so it warns at most once per session.
  • Prevents pytest -Werror failures in sync-only test suites that happen to have pytest-asyncio installed.
  • Add regression tests in tests/test_simple.py.

Test Plan

  • .venv\Scripts\python.exe -m pytest tests/test_simple.py tests/modes/ tests/async_fixtures/ -q --basetemp=.pytest-tmp -> 39 passed, 3 skipped.

Fixes #1344

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Don't warn about asyncio_default_fixture_loop_scope unless the test suite uses pytest-asyncio

2 participants