forked from goodboy/tractor
1
0
Fork 0
tractor/tests
Tyler Goodlet 8ea0f08386 Finally, officially support shielded REPL-ing!
It's been a long time prepped and now finally implemented!

Offer a `shield: bool` argument from our async `._debug` APIs:
- `await tractor.pause(shield=True)`,
- `await tractor.post_mortem(shield=True)`

^-These-^ can now be used inside cancelled `trio.CancelScope`s,
something very handy when introspecting complex (distributed) system
tear/shut-downs particularly under remote error or (inter-peer)
cancellation conditions B)

Thanks to previous prepping in a prior attempt and various patches from
the rigorous rework of `.devx._debug` internals around typed msg specs,
there ain't much that was needed!

Impl deats
- obvi passthrough `shield` from the public API endpoints (was already
  done from a prior attempt).
- put ad-hoc internal `with trio.CancelScope(shield=shield):` around all
  checkpoints inside `._pause()` for both the root-process and subactor
  case branches.

Add a fairly rigorous example, `examples/debugging/shielded_pause.py`
with a wrapping `pexpect` test, `test_debugger.test_shield_pause()` and
ensure it covers as many cases as i can think of offhand:

- multiple `.pause()` entries in a loop despite parent scope
  cancellation in a subactor RPC task which itself spawns a sub-task.
- a `trio.Nursery.parent_task` which raises, is handled and
  tries to enter and unshielded `.post_mortem()`, which of course
  internally raises `Cancelled` in a `._pause()` checkpoint, so we catch
  the `Cancelled` again and then debug the debugger's internal
  cancellation with specific checks for the particular raising
  checkpoint-LOC.
- do ^- the latter -^ for both subactor and root cases to ensure we
  can debug `._pause()` itself when it tries to REPL engage from
  a cancelled task scope Bo
2024-05-30 17:52:24 -04:00
..
conftest.py Add (back) a `tractor._testing` sub-pkg 2024-03-13 09:09:08 -04:00
test_2way.py Move context-streaming operational tests into one mod 2021-12-06 16:45:44 -05:00
test_advanced_faults.py Update tests for `PldRx` and `Context` changes 2024-05-09 16:48:53 -04:00
test_advanced_streaming.py Tweak some tests for spurious failues 2024-03-11 10:37:34 -04:00
test_cancellation.py Update tests for `PldRx` and `Context` changes 2024-05-09 16:48:53 -04:00
test_caps_based_msging.py More msg-spec tests tidying 2024-04-14 19:50:09 -04:00
test_child_manages_service_nursery.py Adjust all `RemoteActorError.type` using tests 2024-03-19 18:08:54 -04:00
test_clustering.py Add (back) a `tractor._testing` sub-pkg 2024-03-13 09:09:08 -04:00
test_context_stream_semantics.py Add a "current IPC `Context`" `ContextVar` 2024-05-07 15:35:45 -04:00
test_debugger.py Finally, officially support shielded REPL-ing! 2024-05-30 17:52:24 -04:00
test_discovery.py Add (back) a `tractor._testing` sub-pkg 2024-03-13 09:09:08 -04:00
test_docs_examples.py Add (back) a `tractor._testing` sub-pkg 2024-03-13 09:09:08 -04:00
test_infected_asyncio.py Update tests for `PldRx` and `Context` changes 2024-05-09 16:48:53 -04:00
test_inter_peer_cancellation.py Update tests for `PldRx` and `Context` changes 2024-05-09 16:48:53 -04:00
test_legacy_one_way_streaming.py Flip a last `MultiError` to a beg, add todo on `@stream` func 2024-04-14 19:39:57 -04:00
test_local.py Add (back) a `tractor._testing` sub-pkg 2024-03-13 09:09:08 -04:00
test_multi_program.py Add (back) a `tractor._testing` sub-pkg 2024-03-13 09:09:08 -04:00
test_pldrx_limiting.py Change `reraise` to `post_mortem: bool` in `maybe_expect_raises()` 2024-05-30 16:02:59 -04:00
test_pubsub.py Add (back) a `tractor._testing` sub-pkg 2024-03-13 09:09:08 -04:00
test_resource_cache.py Bump timeout on resource cache test a bitty bit. 2024-01-03 22:27:05 -05:00
test_rpc.py Adjust all `RemoteActorError.type` using tests 2024-03-19 18:08:54 -04:00
test_runtime.py Drop now-deprecated deps on modern `trio`/Python 2024-03-13 18:41:24 -04:00
test_shm.py Pass `str` dtype for `use_str` case 2023-06-15 12:20:20 -04:00
test_spawning.py Update tests for `PldRx` and `Context` changes 2024-05-09 16:48:53 -04:00
test_task_broadcasting.py Port all tests to new `reg_addr` fixture name 2023-10-18 15:39:20 -04:00
test_trioisms.py Drop now-deprecated deps on modern `trio`/Python 2024-03-13 18:41:24 -04:00