forked from goodboy/tractor
Handle varied multierror order with broker resource err
parent
0dcffeee0f
commit
cef9ab7353
|
@ -122,16 +122,20 @@ def test_multierror_fast_nursery(arb_addr, start_method, num_subactors, delay):
|
||||||
trio.run(main)
|
trio.run(main)
|
||||||
|
|
||||||
assert exc_info.type == tractor.MultiError
|
assert exc_info.type == tractor.MultiError
|
||||||
err = exc_info.value
|
multi = exc_info.value
|
||||||
exceptions = err.exceptions
|
exceptions = multi.exceptions
|
||||||
|
|
||||||
if len(exceptions) == 2:
|
if len(exceptions) == 2:
|
||||||
# sometimes oddly now there's an embedded BrokenResourceError ?
|
# sometimes there's an embedded BrokenResourceError
|
||||||
exceptions = exceptions[1].exceptions
|
# next to the main multierror?
|
||||||
|
|
||||||
assert len(exceptions) == num_subactors
|
|
||||||
|
|
||||||
for exc in exceptions:
|
for exc in exceptions:
|
||||||
|
if hasattr(exc, 'exceptions'):
|
||||||
|
multi = exc
|
||||||
|
break
|
||||||
|
|
||||||
|
assert len(multi.exceptions) == num_subactors
|
||||||
|
|
||||||
|
for exc in multi.exceptions:
|
||||||
assert isinstance(exc, tractor.RemoteActorError)
|
assert isinstance(exc, tractor.RemoteActorError)
|
||||||
assert exc.type == AssertionError
|
assert exc.type == AssertionError
|
||||||
|
|
||||||
|
@ -355,9 +359,13 @@ async def test_nested_multierrors(loglevel, start_method):
|
||||||
depth=depth,
|
depth=depth,
|
||||||
)
|
)
|
||||||
except trio.MultiError as err:
|
except trio.MultiError as err:
|
||||||
|
_err = err
|
||||||
assert len(err.exceptions) == subactor_breadth
|
assert len(err.exceptions) == subactor_breadth
|
||||||
for subexc in err.exceptions:
|
for subexc in err.exceptions:
|
||||||
|
|
||||||
|
# NOTE: use [print(f'err: {err}') for err in _err.exceptions]
|
||||||
|
# to inspect errors from console on failure
|
||||||
|
|
||||||
# verify first level actor errors are wrapped as remote
|
# verify first level actor errors are wrapped as remote
|
||||||
if platform.system() == 'Windows':
|
if platform.system() == 'Windows':
|
||||||
|
|
||||||
|
@ -388,6 +396,8 @@ async def test_nested_multierrors(loglevel, start_method):
|
||||||
else:
|
else:
|
||||||
assert (subexc.type is tractor.RemoteActorError) or (
|
assert (subexc.type is tractor.RemoteActorError) or (
|
||||||
subexc.type is trio.Cancelled)
|
subexc.type is trio.Cancelled)
|
||||||
|
else:
|
||||||
|
pytest.fail(f'Got no error from nursery?')
|
||||||
|
|
||||||
|
|
||||||
@no_windows
|
@no_windows
|
||||||
|
|
Loading…
Reference in New Issue