Description
Describe the bug
When using asyncio with redis.asyncio (redispy), some lines that are definitely hit remain mysteriously uncovered, even when using a combination of different concurrency settings
To Reproduce
- Python version 3.11.4, with coverage 7.3.0 and redis 5.0.0 (OS is Ubuntu 22.04)
- My .coveragerc file:
[run]
source = .
parallel = True
concurrency =
thread
gevent
multiprocessing
(I've tried various combinations of concurrency, but I most often leave it blank. I suspect it's not even appropriate for my application, though I'm not certain)
My minimal example (coverage_test.py):
import asyncio
import redis.asyncio as redis
async def main():
client = redis.Redis()
result = await client.get('key')
print('running main')
if __name__ == '__main__':
asyncio.run(main())
print('finished main')
I issue the coverage command with a bash script (coverage.sh) as follows:
coverage erase
coverage run coverage_test.py
coverage combine
coverage html
xdg-open htmlcov/index.html
The output of the script is:
running main
finished main
And the coverage of the file looks like this:
I would expect the last print statement (which is executed, according to the output) to be marked green. I see there are some similar issues (most notably #1082 and #1598), but as I mentioned I haven't found a concurrency setting that mitigates this.