Open stinovlas opened 1 year ago
@stinovlas Was able to reproduce this bug with the versions you pinned above. I was able to narrow it down to redis==4.5.2
. Tried with redis==4.5.4
and I get the expected result:
OK
Name Stmts Miss Branch BrPart Cover Missing
---------------------------------------------------------
test_bug.py 12 0 2 0 100%
---------------------------------------------------------
TOTAL 12 0 2 0 100%
I think I've run across the same bug in this chunk of code: https://github.com/glyph/Fritter/blob/6a5337db73c0b4ff2d055d415fcf2d3a38a4a5f3/src/fritter/test/test_repeat.py#L123-L142
I am able to work around it if I replace the with self.assertRaises
with a different Twisted idiom for suppressing the cancellation error.
I assume similar to fakeredis
, this code is performing deterministic no-I/O execution of a coroutine.
I have the same issue. It looks like async with
lines get wrongly reported as uncovered
Describe the bug I have a problem with coverage of statements under
async with
while usingfakeredis
library. This problem manifests only underPython 3.11
.Python 3.10
correctly reports 100% coverage. See minimal example below.To Reproduce
Python 3.11.2
coverage debug sys
is helpful.pip freeze
is helpful.Minimal example:
coverage run --branch -m unittest discover; coverage report --show-missing
Expected behavior I expect 100% coverage, which is the case under
Python 3.10.10
. However, underPython 3.11.2
, I encounter this report:Additional context It seems that
fakeredis
(or rather something behind it) is somehow connected to this. When I replacecache.set
andcache.get
withasyncio.sleep
, coverage shows 100% as expected.