Skip to content

Commit d941358

Browse files
committed
Stop using deprecated trio.testing.RaisesGroup.
See python-trio/trio#3326. Apparently Trio maintainers didn't consider the possibility that others wouldn't be using pytest nor want to add it as a dependency just for to get this testing utility.
1 parent 058b6ae commit d941358

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

tests/trio/test_messages.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -508,31 +508,35 @@ async def test_close_is_idempotent(self):
508508

509509
async def test_get_fails_when_get_is_running(self):
510510
"""get cannot be called concurrently."""
511-
with trio.testing.RaisesGroup(ConcurrencyError):
511+
with self.assertRaises(ExceptionGroup) as raised:
512512
async with trio.open_nursery() as nursery:
513513
nursery.start_soon(self.assembler.get)
514514
nursery.start_soon(self.assembler.get)
515+
self.assertIsInstance(raised.exception.exceptions[0], ConcurrencyError)
515516

516517
async def test_get_fails_when_get_iter_is_running(self):
517518
"""get cannot be called concurrently with get_iter."""
518-
with trio.testing.RaisesGroup(ConcurrencyError):
519+
with self.assertRaises(ExceptionGroup) as raised:
519520
async with trio.open_nursery() as nursery:
520521
nursery.start_soon(lambda: alist(self.assembler.get_iter()))
521522
nursery.start_soon(self.assembler.get)
523+
self.assertIsInstance(raised.exception.exceptions[0], ConcurrencyError)
522524

523525
async def test_get_iter_fails_when_get_is_running(self):
524526
"""get_iter cannot be called concurrently with get."""
525-
with trio.testing.RaisesGroup(ConcurrencyError):
527+
with self.assertRaises(ExceptionGroup) as raised:
526528
async with trio.open_nursery() as nursery:
527529
nursery.start_soon(self.assembler.get)
528530
nursery.start_soon(lambda: alist(self.assembler.get_iter()))
531+
self.assertIsInstance(raised.exception.exceptions[0], ConcurrencyError)
529532

530533
async def test_get_iter_fails_when_get_iter_is_running(self):
531534
"""get_iter cannot be called concurrently."""
532-
with trio.testing.RaisesGroup(ConcurrencyError):
535+
with self.assertRaises(ExceptionGroup) as raised:
533536
async with trio.open_nursery() as nursery:
534537
nursery.start_soon(lambda: alist(self.assembler.get_iter()))
535538
nursery.start_soon(lambda: alist(self.assembler.get_iter()))
539+
self.assertIsInstance(raised.exception.exceptions[0], ConcurrencyError)
536540

537541
# Test setting limits.
538542

0 commit comments

Comments
 (0)