Draft test-doc for "out-of-band" `asyncio.Task`..
Since there's no way to activate `greenback`'s portal in such cases, we should at least have a test verifying our very loud error about the inability to support this usage..aio_abandons
parent
85c60095ba
commit
a1d75625e4
|
@ -150,6 +150,18 @@ def pytest_generate_tests(metafunc):
|
||||||
metafunc.parametrize("start_method", [spawn_backend], scope='module')
|
metafunc.parametrize("start_method", [spawn_backend], scope='module')
|
||||||
|
|
||||||
|
|
||||||
|
# TODO: a way to let test scripts (like from `examples/`)
|
||||||
|
# guarantee they won't registry addr collide!
|
||||||
|
# @pytest.fixture
|
||||||
|
# def open_test_runtime(
|
||||||
|
# reg_addr: tuple,
|
||||||
|
# ) -> AsyncContextManager:
|
||||||
|
# return partial(
|
||||||
|
# tractor.open_nursery,
|
||||||
|
# registry_addrs=[reg_addr],
|
||||||
|
# )
|
||||||
|
|
||||||
|
|
||||||
def sig_prog(proc, sig):
|
def sig_prog(proc, sig):
|
||||||
"Kill the actor-process with ``sig``."
|
"Kill the actor-process with ``sig``."
|
||||||
proc.send_signal(sig)
|
proc.send_signal(sig)
|
||||||
|
|
|
@ -218,10 +218,9 @@ def expect_any_of(
|
||||||
)
|
)
|
||||||
|
|
||||||
return expected_patts
|
return expected_patts
|
||||||
# yield child
|
|
||||||
|
|
||||||
|
|
||||||
def test_pause_from_asyncio_task(
|
def test_sync_pause_from_aio_task(
|
||||||
spawn,
|
spawn,
|
||||||
ctlc: bool
|
ctlc: bool
|
||||||
# ^TODO, fix for `asyncio`!!
|
# ^TODO, fix for `asyncio`!!
|
||||||
|
@ -327,3 +326,25 @@ def test_pause_from_asyncio_task(
|
||||||
|
|
||||||
child.sendline('c')
|
child.sendline('c')
|
||||||
child.expect(EOF)
|
child.expect(EOF)
|
||||||
|
|
||||||
|
|
||||||
|
def test_sync_pause_from_non_greenbacked_aio_task():
|
||||||
|
'''
|
||||||
|
Where the `breakpoint()` caller task is NOT spawned by
|
||||||
|
`tractor.to_asyncio` and thus never activates
|
||||||
|
a `greenback.ensure_portal()` beforehand, presumably bc the task
|
||||||
|
was started by some lib/dep as in often seen in the field.
|
||||||
|
|
||||||
|
Ensure sync pausing works when the pause is in,
|
||||||
|
|
||||||
|
- the root actor running in infected-mode?
|
||||||
|
|_ since we don't need any IPC to acquire the debug lock?
|
||||||
|
|_ is there some way to handle this like the non-main-thread case?
|
||||||
|
|
||||||
|
All other cases need to error out appropriately right?
|
||||||
|
|
||||||
|
- for any subactor we can't avoid needing the repl lock..
|
||||||
|
|_ is there a way to hook into `asyncio.ensure_future(obj)`?
|
||||||
|
|
||||||
|
'''
|
||||||
|
pass
|
||||||
|
|
Loading…
Reference in New Issue