Skip to content

Instantly share code, notes, and snippets.

@lmazuel
Last active March 16, 2018 23:28
Show Gist options
  • Save lmazuel/aceffb04d8f97284dcd61a438262c85d to your computer and use it in GitHub Desktop.
Save lmazuel/aceffb04d8f97284dcd61a438262c85d to your computer and use it in GitHub Desktop.
import asyncio
import pytest
@pytest.mark.asyncio
async def test():
iterator = iter([])
return await asyncio.get_event_loop().run_in_executor(
None,
next,
iterator
) # Deadlock
# This freeze pytest. Test should raise the TypeError of Python:
# File "<c:\program files (x86)\python35-32\lib\asyncio\futures.py>", line 365, in set_exception
# raise TypeError("StopIteration interacts badly with generators "
# TypeError: StopIteration interacts badly with generators and cannot be raised into a Future
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment