Mv core impl `tractor_diag.xsh` to `_testing.trace`
Extract all pure-Python diagnostic helpers (`dump_proc_tree`,
`dump_hung_state`, `scan_bindspace`, `dump_all`, `resolve_pids`,
`ensure_sudo_cached`, etc.) from the xonsh xontrib into a new
`tractor/_testing/trace.py` module so the same logic is callable
from both the `acli.*` terminal aliases AND in-test capture-on-hang
fixtures.
Deats,
- `_testing/trace.py`: new module (1171 lines) — proc-tree walker,
hung-state dumper, bindspace scanner, `dump_all()` snapshot
archiver, `AFKAlarmTimeout` exc, `fail_after_w_trace()` async CM
(trio `fail_after` + auto-snapshot on `TooSlowError`),
`afk_alarm_w_trace()` sync CM (`signal.alarm` + snapshot on
`SIGALRM`), plus pytest fixture wrappers for both.
- `_testing/pytest.py`: re-export the two fixtures via `from .trace
import` so pytest plugin-discovery picks them up.
- `tractor_diag.xsh`: thin terminal wrappers that import from
`_testing.trace` — drops ~627 lines of inline impl. Add
`acli.dump_all` alias for full snapshot-bundle CLI access.
(this patch was generated in some part by [`claude-code`][claude-code-gh])
[claude-code-gh]: https://github.com/anthropics/claude-code
(cherry picked from commit 7509e313ff)
(factored: the xontrib-side move-out hunk rides with the diag-xontrib segment)
testing_harness_infra
parent
9fb1c4ccc0
commit
0e32b511bc
|
|
@ -38,6 +38,20 @@ import tractor
|
|||
from tractor.spawn._spawn import SpawnMethodKey
|
||||
import trio
|
||||
|
||||
# Re-export `_testing.trace`'s pytest fixtures so they're
|
||||
# picked up by pytest's plugin-discovery (this module is
|
||||
# loaded via `pytest_plugins` from `pyproject.toml`). The
|
||||
# `noqa: F401` annotations make linters tolerate the
|
||||
# unused-looking imports — they're load-bearing for pytest
|
||||
# discovery. The fixtures share their `name=` kw with the
|
||||
# underlying CM functions; the python-level identifiers
|
||||
# below carry the `_fixture` suffix to avoid module-scope
|
||||
# collision (see `_testing/trace.py` for details).
|
||||
from .trace import ( # noqa: F401
|
||||
afk_alarm_w_trace_fixture,
|
||||
fail_after_w_trace_fixture,
|
||||
)
|
||||
|
||||
# Spawn-backend keys which may appear in `skipon_spawn_backend`
|
||||
# marks ahead of the named backend actually being registered in
|
||||
# `tractor.spawn._spawn.SpawnMethodKey`; such marks are inert
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue