Skip to content

Commit 5b6d287

Browse files
committed
use asyncio.wait_for instead of asyncio.timeout
python versions <= 3.10 dont support `async with asyncio.timeout`
1 parent 19cf273 commit 5b6d287

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

tests/asyncio/test_bidi_async.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,7 @@ async def test_bounded_consume(self):
5555
call.done.return_value = True
5656

5757
with pytest.raises(asyncio.TimeoutError):
58-
async with asyncio.timeout(1):
59-
await anext(gen_aiter)
58+
await asyncio.wait_for(anext(gen_aiter), timeout=1)
6059

6160
assert items == [mock.sentinel.A, mock.sentinel.B]
6261

@@ -114,8 +113,7 @@ async def test_exit_when_inactive_empty(self):
114113
generator.call = call
115114

116115
with pytest.raises(asyncio.TimeoutError):
117-
async with asyncio.timeout(1):
118-
await anext(aiter(generator))
116+
await asyncio.wait_for(anext(aiter(generator)), timeout=1)
119117

120118
async def test_exit_with_stop(self):
121119
q = asyncio.Queue()

0 commit comments

Comments
 (0)