Closed
Description
Describe the bug
When I run two (or more) async iterators in async for
loops, the second loop will have incorrect branch coverage.
To Reproduce
Here's an example:
import asyncio
class AsyncIter:
def __init__(self, items):
self.items = items
async def __aiter__(self):
for i in self.items:
yield i
async def test():
async for i in AsyncIter([1, 2, 3]):
pass
async for i in AsyncIter([1, 2, 3]):
pass
asyncio.run(test())
And the result:
I'm running Coverage 5.5 on Python 3.9 (debug sys output here)
Expected behavior
Same as the non-async version: