Skip to content

Commit

Permalink
Avoid using deprecated run_asyncio
Browse files Browse the repository at this point in the history
I guess this will break in the future as we work through

  python-trio/trio-asyncio#42

but right now I don't care I just want these freaking tests to pass.
  • Loading branch information
njsmith committed Sep 26, 2018
1 parent 36f087f commit aa79c6e
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions pytest_trio/_tests/test_trio_asyncio.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
pytestmark = pytest.mark.skip(reason="trio-asyncio not available")


async def use_run_asyncio():
await trio_asyncio.run_asyncio(asyncio.sleep, 0)
async def use_asyncio():
await trio_asyncio.aio_as_trio(asyncio.sleep)(0)


@pytest.fixture()
Expand All @@ -23,29 +23,29 @@ async def asyncio_loop():
@pytest.fixture()
@async_generator
async def asyncio_fixture_with_fixtured_loop(asyncio_loop):
await use_run_asyncio()
await use_asyncio()
await yield_()


@pytest.fixture()
@async_generator
async def asyncio_fixture_own_loop():
async with trio_asyncio.open_loop():
await use_run_asyncio()
await use_asyncio()
await yield_()


@pytest.mark.trio
async def test_no_fixture():
async with trio_asyncio.open_loop():
await use_run_asyncio()
await use_asyncio()


@pytest.mark.trio
async def test_half_fixtured_asyncpg_conn(asyncio_fixture_own_loop):
await use_run_asyncio()
await use_asyncio()


@pytest.mark.trio
async def test_fixtured_asyncpg_conn(asyncio_fixture_with_fixtured_loop):
await use_run_asyncio()
await use_asyncio()

0 comments on commit aa79c6e

Please sign in to comment.