Such that we can parametrize the `@context(pld_spec)` endpoint setting using `pytest` and of course enable testing more then just the lone `maybe_msg_spec` case. The implementation was a bit tricky because subactors import any `enable_modules` just after subproc spawn, so there's no easy way to indicate from the parent should should be passed to the `@context()` decorator since it's already resolved by the time an IPC is established. Thus the bulk of this patch is implementing a pre-ctx which monkey-patches the (test) `child()`-ep-defining-module before running test logic. Impl deats, - drop `maybe_msg_spec` global instead providing the same value via a new `pld_spec: Union[Type]` parametrized input to the test suite. - add a `decorate_child_ep()` helper which (re-)decorates the mod-defined `child()` IPC-context endpoint with the provided `pld_spec`. - add a new "pre IPC context" endpoint: `set_chld_pldspec()` which can be opened (from another actor) just prior to opening the `child()` ep and it will decorate the latter (using `decorate_child_ep()`) presuming a `.msg._exts.enc_type_union()` generated `pld_spec_strs` is provided. - actually open the `set_chld_pldspec()` as a `deco_ctx` rom the root-actor and ensure we cancel it on block teardown in non-raising cases. |
||
|---|---|---|
| .. | ||
| __init__.py | ||
| conftest.py | ||
| test_ext_types_msgspec.py | ||
| test_pldrx_limiting.py | ||
| test_pretty_struct.py | ||