Skip to content

Conversation

seifertm
Copy link
Contributor

The function wrap_in_sync makes use of of _get_event_loop_no_warn which uses deprecated asyncio functionality.

This PR removes the use of _get_event_loop_no_warn inside wrap_in_sync by hoisting the decision logic for determining the current event loop one level higher. PytestAsyncTest now determines the applicable runner fixture and passes it to wrap_in_sync.

Lastly, the PR renames wrap_in_sync to _synchronize_coroutine.

@seifertm
Copy link
Contributor Author

Degrading this PR to draft state, because the changes cause a warning to be emitted twice.

@seifertm seifertm marked this pull request as draft August 24, 2025 15:13
This fixes a bug that lead to multiple deprecation warnings being emitted.
This should speed up the test suite and give more accurate test coverage numbers.
@codecov-commenter
Copy link

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.81%. Comparing base (5900a4d) to head (12761c1).
⚠️ Report is 8 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1203      +/-   ##
==========================================
+ Coverage   88.91%   90.81%   +1.90%     
==========================================
  Files           2        2              
  Lines         406      403       -3     
  Branches       44       43       -1     
==========================================
+ Hits          361      366       +5     
+ Misses         35       29       -6     
+ Partials       10        8       -2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@seifertm seifertm marked this pull request as ready for review September 3, 2025 06:27
@seifertm seifertm added this pull request to the merge queue Sep 3, 2025
Merged via the queue into pytest-dev:main with commit 7ca56e3 Sep 3, 2025
21 of 22 checks passed
@seifertm seifertm deleted the remove-use-of-deprecated-get-event-loop-from-test-synchronizer branch September 3, 2025 08:16
@seifertm seifertm restored the remove-use-of-deprecated-get-event-loop-from-test-synchronizer branch September 3, 2025 08:18
@seifertm seifertm deleted the remove-use-of-deprecated-get-event-loop-from-test-synchronizer branch September 3, 2025 08:54
@seifertm seifertm added this to the v1.2 milestone Sep 3, 2025
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.

2 participants