Skip to content

Commit 32e1c6c

Browse files
committed
Use Trio's new CancelScope API
1 parent 5e12d31 commit 32e1c6c

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

pytest_trio/_tests/test_fixture_ordering.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ async def crash_late_agen():
171171
raise RuntimeError("crash_late_agen".upper())
172172
173173
async def crash(when, token):
174-
with trio.open_cancel_scope(shield=True):
174+
with trio.CancelScope(shield=True):
175175
await trio.sleep(when)
176176
raise RuntimeError(token.upper())
177177

pytest_trio/plugin.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,7 @@ async def run(self, test_ctx, contextvars_ctx):
235235
# should cancel them.
236236
assert not self.user_done_events
237237
func_value = None
238-
with trio.open_cancel_scope() as cancel_scope:
238+
with trio.CancelScope() as cancel_scope:
239239
test_ctx.test_cancel_scope = cancel_scope
240240
assert not test_ctx.crashed
241241
await self._func(**resolved_kwargs)
@@ -280,7 +280,7 @@ async def run(self, test_ctx, contextvars_ctx):
280280
except BaseException as exc:
281281
assert isinstance(exc, trio.Cancelled)
282282
test_ctx.crash(None)
283-
with trio.open_cancel_scope(shield=True):
283+
with trio.CancelScope(shield=True):
284284
for event in self.user_done_events:
285285
await event.wait()
286286

0 commit comments

Comments
 (0)