pytest_pluginize: expose some pytest reusables from our test harness #27

Open
goodboy wants to merge 7 commits from pytest_pluginize into structural_dynamics_of_flow

7 Commits (main)

Author SHA1 Message Date
Tyler Goodlet 2bb33da9c8 Add a `debug_mode`-state reversion test 2025-05-07 15:06:44 -04:00
Tyler Goodlet 06f7f2e06b Fix ref-err on `logger` input to `get_console_log()`
Particularly on a get-attr of `StackLevelAdapter.handlers` which, when
a `logger: StackLevelAdapter` is passed, we need to *not call* our own
`get_logger()` and just set is as the `log`. Fix the typing to match.
2025-05-07 13:09:33 -04:00
Tyler Goodlet a92d0ebf02 Unset debug-mode on root actor exit
Discovered this bug while testing `modden`'s daemon under various
cancelled-while-booting race conditions where sequential tests would
fail a lingering `assert 0` inside `.to_asyncio.run_as_asyncio_guest()`
to (oddly) catch redundant greenback-re-inits..

XD

Needs a test likely ;P
2025-05-07 10:41:59 -04:00
Tyler Goodlet 8c8d79e475 Expose `.trionics.maybe_collapse_eg` 2025-05-05 17:45:10 -04:00
Tyler Goodlet 0ccf83d520 Use `.is_debug_mode()` for maybe-crash-handling
Such that the default is `None` and in the case where the caller *does
not* set the `pdb` arg to an explicit `bool` we instead determine it via
the output from `._state.is_debug_mode()` allowing for more "nonchalant"
usage throughout a (test) code base which passes the `debug_mode: bool`
as runtime config; allows delegation to the per-actor proc-global state.
2025-05-05 16:03:03 -04:00
Tyler Goodlet 1d54096379 Add todo for `dulwhich` as dep 2025-04-25 23:21:19 -04:00
Tyler Goodlet fe23331365 Plugin-ize some re-usable `conftest` parts
Namely any CLI driven runtime-config fixtures such as,

- `--spawn-backend` and `start_method`,
- `--tpdb` and `debug_mode`,
- `--tpt-proto` and `tpt_protos`/`tpt_proto`,
- `reg_addr` as driven by the above.

This moves all fixtures and necessary hook funcs (CLI parsing,
configuring and test-gen) to the `._testing.pytest` module and thus
allows any dependent project to leverage these fixtures in their own
test suites after pointing to that plugin mod using,

```python
    # conftest.py
    pytest_plugins: tuple[str] = (
        "tractor._testing.pytest",
    )
```

Also, add a new `._testing.addr` helper mod which now contains
a factored `get_rando_addr()` helper for creating test-sesh unique
tpt-specific registry (or other) IPC endpoint addrs.
2025-04-17 11:20:49 -04:00