Limit event_loop_policy parametrization to async tests#1491
Open
lin-hongkuan wants to merge 1 commit into
Open
Limit event_loop_policy parametrization to async tests#1491lin-hongkuan wants to merge 1 commit into
lin-hongkuan wants to merge 1 commit into
Conversation
141490b to
3080bc3
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1491 +/- ##
==========================================
- Coverage 94.50% 93.30% -1.21%
==========================================
Files 2 2
Lines 510 523 +13
Branches 62 66 +4
==========================================
+ Hits 482 488 +6
- Misses 22 25 +3
- Partials 6 10 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tjkuson
reviewed
Jun 25, 2026
tjkuson
left a comment
Contributor
There was a problem hiding this comment.
Noting #796 (comment), we should probably be wary of implementing pytest hacks in order to resolve an issue with a deprecated feature.
| for marker in metafunc.definition.iter_markers(name="usefixtures") | ||
| ): | ||
| return | ||
| if fixture_name in metafunc.fixturenames: |
Contributor
There was a problem hiding this comment.
This breaks valid usage for the same reason described here #1454
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
event_loop_policyautouse fixture overrides from applying to synchronous tests that do not request the fixtureevent_loop_policyintact, including direct fixture arguments andusefixturesFixes #796
Tests
python -m pytest tests\markers\test_event_loop_policy.py -q -p no:twistedpython -m pytest tests\markers\test_function_scope.py::test_asyncio_mark_respects_parametrized_loop_policies tests\markers\test_function_scope.py::test_event_loop_policy_fixture_override_emits_deprecation_warning tests\markers\test_function_scope.py::test_default_event_loop_policy_fixture_does_not_warn -q -p no:twistedpython -m pytest tests\markers -q -p no:twistedpython -m ruff check pytest_asyncio\plugin.py tests\markers\test_event_loop_policy.pypython -m ruff format --check pytest_asyncio\plugin.py tests\markers\test_event_loop_policy.pygit diff --checkNote: I used
-p no:twistedlocally because this environment has an unrelated globalpytest-twistedplugin installed, and it interferes with pytester subprocess runs. The pytest-asyncio tests themselves pass with that unrelated plugin disabled.