Files
DeepTutor/tests
panghufattiger996-maker 65dcf1f0d0 test(parsing): restore MinerU deadline and process cleanup coverage
#3089 fixed the Windows CI race between fixture startup and the deadline
check, but it left two coverage gaps that let the tests pass without
verifying anything.

The explicit-timeout test allowed `elapsed < 20` for a 1.2s deadline.
Postponing the deadline comparison by eight seconds still passed it
(measured: 9.26s, green). The cleanup test allowed `elapsed < 15` while its
grandchild only slept 10s, so an implementation that waited for the
descendant to exit on its own would also finish in time.

Both were reproduced. Reverting only the skip recording, and delaying the
deadline, each kept the old assertions green.

What changed
------------

Timing is now driven by a fake clock over the real poll loop, so the test
asks "did the loop stop at the configured instant" without interpreter
startup, poll scheduling or tree teardown landing in the measurement. The
helper lives in `_mineru_deadline_probe.py`.

- Covers several configured deadlines, continuous output (which refreshes
  the loop's `activity` value and must not extend the total deadline), and a
  CLI that exits normally before the deadline.
- The assertion is anchored on the first poll at or beyond the deadline
  rather than on a tolerance band, so the poll interval is not baked into
  the test. Verified still green with the production interval changed to
  50ms and 70ms.

Cleanup keeps real subprocesses, which is the only way to observe that the
tree is gone.

- The fixture publishes its PID through a temp file and rename, so the path
  never exists with partial contents.
- It also takes an independent exit signal, so a failure before the PID is
  published still lets the test tear its own process down.

Only test files change.

Verification
------------

- Windows / Python 3.13: `test_mineru_process_lifecycle.py` 10 passed,
  10 skipped (the skips are POSIX process-group cases), plus the launcher's
  detached-console test green.
- `ruff check` and `ruff format --check` clean on `tests/services/parsing/`.
- Injecting a deadline delay, hard-coding the deadline, comparing against
  `activity` instead of `started`, shortening the deadline, or replacing it
  with a constant all make the suite fail as intended.

Three pre-existing failures in `tests/runtime/test_launcher.py`
(`test_terminate_warns_*`, `test_kill_port_listeners_*`) reproduce on the
base commit `2d329c219` and are unrelated to this change.

Follow-up to #3089. Related to #3088.
2026-11-30 23:43:13 +08:00
..
2026-11-06 01:56:40 +08:00
2026-11-06 01:56:39 +08:00