bloomberg / pytest-memray

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

Cooperate with anyio #122

Open godlygeek opened 2 weeks ago

godlygeek commented 2 weeks 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 wrapping our wrapper in an async def function, when the wrapped function is a coroutine function.

Closes #119

godlygeek commented 2 weeks 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 2 weeks ago

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