Skip to content

pytest is stuck in teardown when using uvloop #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
sk- opened this issue Jun 2, 2025 · 0 comments
Open

pytest is stuck in teardown when using uvloop #1134

sk- opened this issue Jun 2, 2025 · 0 comments

Comments

@sk-
Copy link

sk- commented Jun 2, 2025

First of all, thanks for the all the work put to release v1.0.0. It was really easy to migrate from v0.21. However we found a weird issue when using uvloop (based on the docs).

Using asyncio´s loop we had no issues and test would run normally. However, when using uvloop, tests would get silently stuck at the final teardown. After a lot of debugging I could track the issue to _provide_event_loop, which triggers a ResourceWarning in uvlopp's __uv_walk_close_all_handles_cb.

This warning is caught by pytest's catch_unraisable_exception, so maybe this issue will get resolved with pytest-dev/pytest#12958.

What made the issue hard to understand was the fact that no information was printed out, and that it only fails when warnings are treated as errors. I removed error from filterwarnings and the test passed without problem, but also without printing out the warnings.

At the end we kept errors in filterwarnings and added the entry ignore:unclosed resource <TCPTransport:ResourceWarning.

Below is a debugging capture of the warning producing the issue
Image

System info:
Python version: Python 3.12.9 (main, Feb 12 2025, 15:09:19) [Clang 19.1.6 ] on darwin
Pytest: 8.3.5
Pytest-asyncio: 1.0.0

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

No branches or pull requests

1 participant