pytest-asyncio icon indicating copy to clipboard operation
pytest-asyncio copied to clipboard

Enable "asyncio debug mode" for default event loop

Open p-rogalski opened this issue 1 year ago • 3 comments

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.

p-rogalski avatar Nov 06 '24 12:11 p-rogalski

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

Adding a config option sound like a great idea though.

asvetlov avatar Nov 06 '24 13:11 asvetlov

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.

seifertm avatar Nov 06 '24 15:11 seifertm

This could be made configurable via a config option

This issue can be closed due to the PYTHONASYNCIODEBUG=1 existence.

alessio-locatelli avatar Mar 12 '25 09:03 alessio-locatelli

Debug mode can be activated as of pytest-asyncio v.1.2.0.

seifertm avatar Sep 12 '25 07:09 seifertm