Skip to content

Commit

Permalink
Merge 26c3980 into 5e3a173
Browse files Browse the repository at this point in the history
  • Loading branch information
vxgmichel committed Feb 22, 2020
2 parents 5e3a173 + 26c3980 commit 95015f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 0 deletions.
5 changes: 5 additions & 0 deletions aiostream/aiter_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,8 +153,13 @@ async def __aexit__(self, typ, value, traceback):
if not getattr(self._aiterator, "ag_frame", True):
return False

# Cannot throw at the moment
if getattr(self._aiterator, 'ag_running', False):
return False

# Throw
try:
print(typ, value, traceback)
await self._aiterator.athrow(typ, value, traceback)
raise RuntimeError(
"Async iterator didn't stop after athrow()")
Expand Down
2 changes: 2 additions & 0 deletions aiostream/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ async def cancel_task(self, task):
await task
except asyncio.CancelledError:
pass
except StopAsyncIteration:
pass


class StreamerManager:
Expand Down
6 changes: 6 additions & 0 deletions tests/test_combine.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ async def test_merge(assert_run, event_loop):
await assert_run(ys[:3], [0, 1, 2])
assert event_loop.steps == [1, 1]

with event_loop.assert_cleanup():
xs = stream.just(1) + stream.never()
ys = xs | pipe.merge(xs) | pipe.timeout(1)
await assert_run(ys, [1, 1], asyncio.TimeoutError())
assert event_loop.steps == [1]


@pytest.mark.asyncio
async def test_ziplatest(assert_run, event_loop):
Expand Down

0 comments on commit 95015f3

Please sign in to comment.