test(repo): halve the backend suite, block unmocked network in tests (#937) #938
Loading…
Reference in a new issue
No description provided.
Delete branch "test/937-backend-suite-speed"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #937.
The default backend run goes from 1,061 s to 536 s locally, with the same tests passing.
1. Stub the local-Whisper
/healthprobe by default.LocalWhisperProvider.submit()probes/healthbefore transcribing. Tests mocked the transcribe call but not the probe, so about 30 recording-pipeline tests each paid a failing DNS lookup (~3 s) plus the 5 s_HEALTH_TIMEOUT, then silently fell back to v1. The fixture that clears the capability cache (#352) meant every test paid it again. An autouse fixture now returns the probe's own fallback value directly. Tests that exercise the probe carry@pytest.mark.real_asr_probeand mock the HTTP themselves: two whole modules, plus individual tests in six others.2. A network guard.
An autouse fixture wraps
socket.getaddrinfo. Resolving anything other than loopback, an IP literal or the test database's host raisesgaierrorimmediately, and the test fails at teardown naming the host, even when the code under test swallowed the error, as the probe did. The opt-out is@pytest.mark.allow_network; no test needed it. It caught one real case:test_a_hostname_that_does_not_resolve_says_sodepended on live DNS and now mocks the failure. There's no new dependency, becausepytest-socketguardsconnect(), and the lookup is where most of the time went.3. Synthetic-session harness out of the default run.
The four
test_synthetic_session_*modules are markedsynthetic, and the backend CI job runspytest -x -q -m "not synthetic". Thesynthetic-sessionjob is unchanged: it passes explicit files and there's noaddopts, so it still runs all 105 tests. They stay serial, per #684.Also updated: the
/qb-testrecipe (backend deselectssynthetic, plus a newsyntheticsection) and a changelog fragment.Verified locally:
-m synthetic: 105 passed in 294 s.🤖 Generated with Claude Code