tractor/tests
Tyler Goodlet 61f6690261 Finally get type-extended `msgspec` fields workinn
By using our new `PldRx` design we can,
- pass through the pld-spec & a `dec_hook()` to our `MsgDec` which is
  used to configure the underlying `.dec: msgspec.msgpack.Decoder`
- pass through a `enc_hook()` to `mk_codec()` and use it to conf the
  equiv `MsgCodec.enc` such that sent msg-plds are converted prior
  to transport.

The trick ended up being just to always union the `mk_dec()`
extension-types spec with the normaly with the `msgspec.Raw` pld-spec
such that the `dec_hook()` is only invoked for payload types tagged
by the encoder/sender side B)

A variety of impl tweaks to make it all happen as well as various
cleanups in the `.msg._codec` mod include,

- `mk_dec()` no defaul `spec` arg, better doc string, accept the new
  `ext_types` arg, doing the union of that with `msgspec.Raw`.
- proto-ed a now unused `mk_boxed_ext_struct()` which will likely get
  removed since it ended up that our `PayloadMsg` structs already cover
  the ext-type-hook requirement that the decoder is passed
  a `.type=msgspec.Struct` of some sort in order for `.dec_hook` to be
  used.
- add a `unpack_spec_types()` util fn for getting the `set[Type]` from
  from a `Union[Type]` annotation instance.
- mk the default `mk_codec(pc_pld_spec = Raw,)` since the `PldRx` design
  was already passing/overriding it and it doesn't make much sense to
  use `Any` anymore for the same reason; it will cause various `Context`
  apis to now break.
  |_ also accept a `enc_hook()` and `ext_types` which are used to maybe
     config the `.msgpack.Encoder`
- generally tweak a bunch of comments-as-docs and todos namely the ones
  that are completed after the pld-rx design was implemented.

Also,
- mask the non-functioning `'defstruct'` approach `inside
  `.msg.types.mk_msg_spec()` to prep for its removal.

Adjust the test suite (rn called `test_caps_based_msging`),
- add a new suite `test_custom_extension_types` and move and
  use the `enc/dec_nsp()` hooks to the mod level for its use.
- prolly planning to drop the `test_limit_msgspec` suite since it's
  mostly replaced by the `test_pldrx_limiting` mod's version?
- originally was tweaking a bunch in `test_codec_hooks_mod` but likely
  it will get mostly rewritten to be simpler and simply verify that
  ext-typed fields can be used over IPC `Context`s between actors (as
  originally intended for this sub-suite).
2025-03-10 12:18:26 -04:00
..
devx Mask ctlc borked REPL tests 2025-03-10 12:17:53 -04:00
conftest.py Add (masked) meta-debug-fixture for determining if `debug_mode` is set in harness.. 2025-03-10 12:17:53 -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 Another couple loose-ifies for discovery and advanced fault suites 2025-03-10 12:17:53 -04:00
test_advanced_streaming.py Various test tweaks related to 3.13 egs 2025-03-10 12:17:53 -04:00
test_cancellation.py Various test tweaks related to 3.13 egs 2025-03-10 12:17:53 -04:00
test_caps_based_msging.py Finally get type-extended `msgspec` fields workinn 2025-03-10 12:18:26 -04:00
test_child_manages_service_nursery.py Various test tweaks related to 3.13 egs 2025-03-10 12:17:53 -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 Change `tractor.breakpoint()` to new `.pause()` in test suite 2024-12-09 16:08:55 -05:00
test_discovery.py Another couple loose-ifies for discovery and advanced fault suites 2025-03-10 12:17:53 -04:00
test_docs_examples.py Fix docs tests with yet another loosie-goosie 2025-03-10 12:17:53 -04:00
test_infected_asyncio.py Be extra sure to re-raise EoCs from translator 2025-03-10 12:17:53 -04:00
test_inter_peer_cancellation.py Another `is` fix.. 2025-03-10 12:17: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 Finally implement peer-lookup optimization.. 2024-07-04 19:40:11 -04:00
test_multi_program.py Finally implement peer-lookup optimization.. 2024-07-04 19:40:11 -04:00
test_pldrx_limiting.py Update `MsgTypeError` content matching to latest 2024-06-28 14:46:29 -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_root_infect_asyncio.py Be extra sure to re-raise EoCs from translator 2025-03-10 12:17:53 -04: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 Use `collapse_eg()` in broadcaster suite 2025-03-10 12:17:53 -04:00
test_trioisms.py Another loosie in the trioisms suite 2025-03-10 12:17:53 -04:00