pytest-dev / pytest-asyncio

Asyncio support for pytest
https://pytest-asyncio.readthedocs.io
Apache License 2.0
1.43k stars 152 forks source link

Enable "asyncio debug mode" for default event loop #980

Open p-rogalski opened 2 weeks ago

p-rogalski commented 2 weeks ago

The Python asyncio library has a debug mode, which is supposed to ease developing: https://docs.python.org/3/library/asyncio-dev.html#debug-mode

What about enabling this in pytest-asyncio for the default event loop? This could be made configurable via a config option.

asvetlov commented 2 weeks ago

I expect a lot of Executing <...> took 0.103 seconds warnings at least.

Adding a config option sound like a great idea though.

seifertm commented 2 weeks ago

I would also support a PR that adds a config option (+command line option) to enable the debug mode.

Until then, you can use some of the existing means to enable debug mode, such as setting the PYTHONASYNCIODEBUG environment variable.