Add an unserializable value causes error before started test
parent
4001d2c3fc
commit
c38d0f826e
|
@ -58,6 +58,33 @@ from conftest import tractor_test
|
||||||
_state: bool = False
|
_state: bool = False
|
||||||
|
|
||||||
|
|
||||||
|
@tractor.context
|
||||||
|
async def error_before_started(
|
||||||
|
ctx: tractor.Context,
|
||||||
|
) -> None:
|
||||||
|
# send an unserializable type
|
||||||
|
await ctx.started(object())
|
||||||
|
|
||||||
|
|
||||||
|
def test_error_before_started():
|
||||||
|
async def main():
|
||||||
|
async with tractor.open_nursery() as n:
|
||||||
|
portal = await n.start_actor(
|
||||||
|
'errorer',
|
||||||
|
enable_modules=[__name__],
|
||||||
|
)
|
||||||
|
|
||||||
|
async with portal.open_context(
|
||||||
|
error_before_started
|
||||||
|
) as (ctx, sent):
|
||||||
|
await trio.sleep(1)
|
||||||
|
|
||||||
|
with pytest.raises(tractor.RemoteActorError) as excinfo:
|
||||||
|
trio.run(main)
|
||||||
|
|
||||||
|
assert excinfo.value.type == TypeError
|
||||||
|
|
||||||
|
|
||||||
@tractor.context
|
@tractor.context
|
||||||
async def too_many_starteds(
|
async def too_many_starteds(
|
||||||
ctx: tractor.Context,
|
ctx: tractor.Context,
|
||||||
|
@ -466,7 +493,7 @@ async def cancel_self(
|
||||||
try:
|
try:
|
||||||
async with ctx.open_stream():
|
async with ctx.open_stream():
|
||||||
pass
|
pass
|
||||||
except ContextCancelled:
|
except tractor.ContextCancelled:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
# check a real ``trio.Cancelled`` is raised on a checkpoint
|
# check a real ``trio.Cancelled`` is raised on a checkpoint
|
||||||
|
|
Loading…
Reference in New Issue