You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When using coverage in a FastAPI project that uses SQLAlchemy and asyncpg, parts of the code are wrongly reported as not covered. I know that the affected code statements do run, because otherwise the tests would fail. I also checked this by setting debugger breakpoints.
My tests so far indicate that this only happens if the test goes through a FastAPI router function. If I instead call the affected function directly, the coverage report is correct.
Unfortunately the most minimal MRE I was able to come up with involves Postgres and a bunch of dependencies. Sorry about that. On the other hand, I think my stack is not that exotic, so probably sooner or later others will also run into this issue.
To Reproduce
What version of Python are you using?
I tested with Python 3.7.3 and Python 3.9.6.
What version of coverage.py are you using? The output of coverage debug sys is helpful.
Describe the bug
When using coverage in a FastAPI project that uses SQLAlchemy and asyncpg, parts of the code are wrongly reported as not covered. I know that the affected code statements do run, because otherwise the tests would fail. I also checked this by setting debugger breakpoints.
My tests so far indicate that this only happens if the test goes through a FastAPI router function. If I instead call the affected function directly, the coverage report is correct.
Unfortunately the most minimal MRE I was able to come up with involves Postgres and a bunch of dependencies. Sorry about that. On the other hand, I think my stack is not that exotic, so probably sooner or later others will also run into this issue.
To Reproduce
What version of Python are you using?
I tested with Python 3.7.3 and Python 3.9.6.
What version of coverage.py are you using? The output of
coverage debug sys
is helpful.What versions of what packages do you have installed? The output of
pip freeze
is helpful.What code are you running? Give us a specific commit of a specific repo that we can check out.
https://github.com/rfleschenberg/coverage-sqlalchemy-async/tree/ea17b8f9a3fddb1c62212803b6793aa4f9c63561
Expected behavior
A correct coverage report ;)
The text was updated successfully, but these errors were encountered: