Repository navigation
fix: apply loop factories to parametrized asyncio marks - #1574
Samuel-Hills wants to merge 2 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1574 +/- ##
==========================================
+ Coverage 94.50% 94.68% +0.17%
==========================================
Files 2 2
Lines 510 527 +17
Branches 62 65 +3
==========================================
+ Hits 482 499 +17
Misses 22 22
Partials 6 6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
tjkuson
left a comment
There was a problem hiding this comment.
Thank you for your interest in contributing! I assume this relates to #1463?
The solution in this PR still parametrizes the whole test function and doesn't resolve the mixed backend problem described in the issue. With two loop factories and asyncio/trio markers, this produces two asyncio and two trio cases. The trio case should only run once. This is the same issue discussed in #1551 which was a attempt at a solution.
| if len(marker.args) < 2: | ||
| continue | ||
| for parameter_set in marker.args[1]: | ||
| if any(mark.name == "asyncio" for mark in parameter_set.marks): |
There was a problem hiding this comment.
Parameter values do not have to be pytest.param objects. In strict mode, an async test for another plugin with, e.g., @pytest.mark.parametrize("value", [1, 2]), now fails during collection.
| marker_loop_scope, marker_selected_factory_names = _parse_asyncio_marker( | ||
| asyncio_marker | ||
| ) | ||
| if asyncio_marker is None: |
There was a problem hiding this comment.
This ignores the factory selection on the parameter's asyncio mark. With factories "a" and "b", a parameter marked pytest.mark.asyncio(loop_factories=["b"]) still runs with both factories.
No description provided.