From 32e1c6cbd8b3792e9e368907581b41a6701af65e Mon Sep 17 00:00:00 2001 From: Zac-HD Date: Mon, 28 Jan 2019 00:20:44 -1000 Subject: [PATCH] Use Trio's new CancelScope API --- pytest_trio/_tests/test_fixture_ordering.py | 2 +- pytest_trio/plugin.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pytest_trio/_tests/test_fixture_ordering.py b/pytest_trio/_tests/test_fixture_ordering.py index 352ca6a..7693769 100644 --- a/pytest_trio/_tests/test_fixture_ordering.py +++ b/pytest_trio/_tests/test_fixture_ordering.py @@ -171,7 +171,7 @@ async def crash_late_agen(): raise RuntimeError("crash_late_agen".upper()) async def crash(when, token): - with trio.open_cancel_scope(shield=True): + with trio.CancelScope(shield=True): await trio.sleep(when) raise RuntimeError(token.upper()) diff --git a/pytest_trio/plugin.py b/pytest_trio/plugin.py index 9d86159..0b9b2b4 100644 --- a/pytest_trio/plugin.py +++ b/pytest_trio/plugin.py @@ -235,7 +235,7 @@ async def run(self, test_ctx, contextvars_ctx): # should cancel them. assert not self.user_done_events func_value = None - with trio.open_cancel_scope() as cancel_scope: + with trio.CancelScope() as cancel_scope: test_ctx.test_cancel_scope = cancel_scope assert not test_ctx.crashed await self._func(**resolved_kwargs) @@ -280,7 +280,7 @@ async def run(self, test_ctx, contextvars_ctx): except BaseException as exc: assert isinstance(exc, trio.Cancelled) test_ctx.crash(None) - with trio.open_cancel_scope(shield=True): + with trio.CancelScope(shield=True): for event in self.user_done_events: await event.wait()