From 0aada63b927d458b20f1da69a4818651e33c1ec2 Mon Sep 17 00:00:00 2001 From: Joshua Oreman Date: Thu, 8 Aug 2019 01:51:12 +0200 Subject: [PATCH] Add regression test for #552 --- trio/_core/tests/test_run.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/trio/_core/tests/test_run.py b/trio/_core/tests/test_run.py index 52ca1aab06..a5345424ed 100644 --- a/trio/_core/tests/test_run.py +++ b/trio/_core/tests/test_run.py @@ -1797,6 +1797,16 @@ async def misguided(): assert any(entry.name == "child_xyzzy" for entry in excinfo.traceback) +async def test_asyncio_function_inside_nursery_does_not_explode(): + # Regression test for https://github.com/python-trio/trio/issues/552 + with pytest.raises(TypeError) as excinfo: + async with _core.open_nursery() as nursery: + import asyncio + nursery.start_soon(sleep_forever) + await asyncio.Future() + assert "asyncio" in str(excinfo.value) + + async def test_trivial_yields(): with assert_checkpoints(): await _core.checkpoint()