Skip to content

Commit ecc3f5e

Browse files
committed
Test fixups
1 parent 39d0f6f commit ecc3f5e

File tree

5 files changed

+12
-12
lines changed

5 files changed

+12
-12
lines changed

trio/testing/_check_streams.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ async def send_empty_then_y():
113113
nursery.start_soon(do_send_all, b"x")
114114
assert await do_receive_some(None) == b"x"
115115

116-
with _assert_raises(_core.BusyResourceError):
116+
with _assert_raises(_core._multierror.NonBaseMultiError):
117117
async with _core.open_nursery() as nursery:
118118
nursery.start_soon(do_receive_some, 1)
119119
nursery.start_soon(do_receive_some, 1)
@@ -307,7 +307,7 @@ async def receiver():
307307

308308
async with _ForceCloseBoth(await clogged_stream_maker()) as (s, r):
309309
# simultaneous wait_send_all_might_not_block fails
310-
with _assert_raises(_core.BusyResourceError):
310+
with _assert_raises(_core._multierror.NonBaseMultiError):
311311
async with _core.open_nursery() as nursery:
312312
nursery.start_soon(s.wait_send_all_might_not_block)
313313
nursery.start_soon(s.wait_send_all_might_not_block)
@@ -316,7 +316,7 @@ async def receiver():
316316
# this test might destroy the stream b/c we end up cancelling
317317
# send_all and e.g. SSLStream can't handle that, so we have to
318318
# recreate afterwards)
319-
with _assert_raises(_core.BusyResourceError):
319+
with _assert_raises(_core._multierror.NonBaseMultiError):
320320
async with _core.open_nursery() as nursery:
321321
nursery.start_soon(s.wait_send_all_might_not_block)
322322
nursery.start_soon(s.send_all, b"123")

trio/tests/test_signals.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ async def naughty():
6565

6666

6767
async def test_open_signal_receiver_conflict():
68-
with pytest.raises(trio.BusyResourceError):
68+
with pytest.raises(_core._multierror.NonBaseMultiError):
6969
with open_signal_receiver(signal.SIGILL) as receiver:
7070
async with trio.open_nursery() as nursery:
7171
nursery.start_soon(receiver.__anext__)

trio/tests/test_ssl.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -354,14 +354,14 @@ async def test_PyOpenSSLEchoStream_gives_resource_busy_errors():
354354
# PyOpenSSLEchoStream will notice and complain.
355355

356356
s = PyOpenSSLEchoStream()
357-
with pytest.raises(_core.BusyResourceError) as excinfo:
357+
with pytest.raises(_core._multierror.NonBaseMultiError) as excinfo:
358358
async with _core.open_nursery() as nursery:
359359
nursery.start_soon(s.send_all, b"x")
360360
nursery.start_soon(s.send_all, b"x")
361361
assert "simultaneous" in str(excinfo.value)
362362

363363
s = PyOpenSSLEchoStream()
364-
with pytest.raises(_core.BusyResourceError) as excinfo:
364+
with pytest.raises(_core._multierror.NonBaseMultiError) as excinfo:
365365
async with _core.open_nursery() as nursery:
366366
nursery.start_soon(s.send_all, b"x")
367367
nursery.start_soon(s.wait_send_all_might_not_block)
@@ -732,14 +732,14 @@ async def do_wait_send_all_might_not_block():
732732
await s.wait_send_all_might_not_block()
733733

734734
s, _ = ssl_lockstep_stream_pair(client_ctx)
735-
with pytest.raises(_core.BusyResourceError) as excinfo:
735+
with pytest.raises(_core._multierror.NonBaseMultiError) as excinfo:
736736
async with _core.open_nursery() as nursery:
737737
nursery.start_soon(do_send_all)
738738
nursery.start_soon(do_send_all)
739739
assert "another task" in str(excinfo.value)
740740

741741
s, _ = ssl_lockstep_stream_pair(client_ctx)
742-
with pytest.raises(_core.BusyResourceError) as excinfo:
742+
with pytest.raises(_core._multierror.NonBaseMultiError) as excinfo:
743743
async with _core.open_nursery() as nursery:
744744
nursery.start_soon(do_receive_some)
745745
nursery.start_soon(do_receive_some)

trio/tests/test_testing.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,7 @@ async def getter(expect):
288288
nursery.start_soon(putter, b"xyz")
289289

290290
# Two gets at the same time -> BusyResourceError
291-
with pytest.raises(_core.BusyResourceError):
291+
with pytest.raises(_core._multierror.NonBaseMultiError):
292292
async with _core.open_nursery() as nursery:
293293
nursery.start_soon(getter, b"asdf")
294294
nursery.start_soon(getter, b"asdf")
@@ -359,7 +359,7 @@ async def do_send_all_count_resourcebusy():
359359
nursery.start_soon(do_send_all_count_resourcebusy)
360360
nursery.start_soon(do_send_all_count_resourcebusy)
361361

362-
assert resource_busy_count == 1
362+
assert resource_busy_count == 2
363363

364364
with assert_checkpoints():
365365
await mss.aclose()
@@ -422,7 +422,7 @@ async def do_receive_some(max_bytes):
422422
mrs.put_data(b"abc")
423423
assert await do_receive_some(None) == b"abc"
424424

425-
with pytest.raises(_core.BusyResourceError):
425+
with pytest.raises(_core._multierror.NonBaseMultiError):
426426
async with _core.open_nursery() as nursery:
427427
nursery.start_soon(do_receive_some, 10)
428428
nursery.start_soon(do_receive_some, 10)

trio/tests/test_util.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ async def wait_with_ul1():
5353
with ul1:
5454
await wait_all_tasks_blocked()
5555

56-
with pytest.raises(_core.BusyResourceError) as excinfo:
56+
with pytest.raises(_core._multierror.NonBaseMultiError) as excinfo:
5757
async with _core.open_nursery() as nursery:
5858
nursery.start_soon(wait_with_ul1)
5959
nursery.start_soon(wait_with_ul1)

0 commit comments

Comments
 (0)