bloomberg / pytest-memray

pytest plugin for easy integration of memray memory profiler
https://pytest-memray.readthedocs.io/en/latest/
Apache License 2.0
354 stars 25 forks source link

Cooperate with anyio #122

Closed godlygeek closed 4 months ago

godlygeek commented 5 months ago

anyio allows running async def test functions, but the wrapper installed by Memray to add tracking around the test function breaks anyio's detection.

Work around this by using an async def wrapper when the function being wrapped is a coroutine function.

Closes #119

godlygeek commented 5 months ago

Nope, this doesn't actually work. This gets anyio working, but pytest-memray doesn't wind up working (it just tracks the allocations of creating the coroutine, not of actually executing it).

I'll need to take another swing at this, marking as draft for now...

godlygeek commented 5 months ago

OK, this now actually works, and has a test to prove it.