Use `._testing.break_ipc()` in final advanced fault test child ctx
parent
0fcd424d57
commit
5b551dd9fa
|
@ -13,6 +13,7 @@ import trio
|
||||||
import tractor
|
import tractor
|
||||||
from tractor._testing import (
|
from tractor._testing import (
|
||||||
examples_dir,
|
examples_dir,
|
||||||
|
break_ipc,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@ -93,7 +94,8 @@ def test_ipc_channel_break_during_stream(
|
||||||
expect_final_exc = trio.ClosedResourceError
|
expect_final_exc = trio.ClosedResourceError
|
||||||
|
|
||||||
mod: ModuleType = import_path(
|
mod: ModuleType = import_path(
|
||||||
examples_dir() / 'advanced_faults' / 'ipc_failure_during_stream.py',
|
examples_dir() / 'advanced_faults'
|
||||||
|
/ 'ipc_failure_during_stream.py',
|
||||||
root=examples_dir(),
|
root=examples_dir(),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -224,9 +226,15 @@ async def break_ipc_after_started(
|
||||||
) -> None:
|
) -> None:
|
||||||
await ctx.started()
|
await ctx.started()
|
||||||
async with ctx.open_stream() as stream:
|
async with ctx.open_stream() as stream:
|
||||||
await stream.aclose()
|
|
||||||
await trio.sleep(0.2)
|
# TODO: make a test which verifies the error
|
||||||
await ctx.chan.send(None)
|
# for this, i.e. raises a `MsgTypeError`
|
||||||
|
# await ctx.chan.send(None)
|
||||||
|
|
||||||
|
await break_ipc(
|
||||||
|
stream=stream,
|
||||||
|
pre_close=True,
|
||||||
|
)
|
||||||
print('child broke IPC and terminating')
|
print('child broke IPC and terminating')
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue