test: shared LiveServerCase fixture replaces 21 hand-rolled harnesses - #140
Merged
Merged
Conversation
Every integration class hand-rolled the same setUpClass: tempdir, websh.json write, WEBSH_CONFIG export, config-cache reset, creds-file plumbing, module-global monkeypatching, server-on-port-0 + thread + flat 0.2s sleep, mirrored teardown - plus per-class urlopen helpers re-implementing the same JSON dance. One declarative base now carries all of it (CONFIG / ENV / GLOBALS / CREDS / CREDS_PATH / START_SERVER hooks); genuinely unique bits (the E2E ssh/tmux probe, the AAD-bound creds blobs, helper-signature shims) stay as small overrides. -530 lines, and the suite got faster (28.6s -> 24.6s): readiness is now an /api/ping poll in 10ms steps instead of 21 flat sleeps. Coverage is preserved, not weakened: test IDs are byte-identical to the pre-refactor run (486, 1 skip), JSON parsing stays STRICT by default (a stdlib HTML error page leaking out still fails the test; the two vault classes that historically asserted on a raw fallback opt in via TOLERANT_JSON), and the concurrency class keeps its deliberate timeout=10.
# Conflicts: # test_server.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Every integration class hand-rolled the same
setUpClass: tempdir, websh.json write,WEBSH_CONFIGexport, config-cache reset, creds-file plumbing, module-global monkeypatching, server-on-port-0 + thread + flatsleep(0.2), mirrored teardown — plus per-class urlopen helpers re-implementing the same JSON dance.One declarative base now carries all of it:
Genuinely unique bits stay as small overrides: the E2E ssh/tmux probe (
START_SERVER=False), the AAD-bound creds-blob generation, and thin helper-signature shims where tests call legacy shapes.Numbers
/api/pingpoll in 10 ms steps instead of 21 flat sleeps (/api/pingconsumes no rate-limit token — verified)Coverage preserved, not weakened (adversarial review)
send_errorleaking out still fails ~42 tests that don't assert on the body. The two vault classes that historically asserted on a{"_raw": ...}fallback opt in viaTOLERANT_JSON = True.timeout=10.CONFIG=Noneclasses match the old bare-server fixtures exactly (load_configreturns_CONFIG_EMPTYbefore consulting the cache whenWEBSH_CONFIGis unset).Tests
python3 test_server.py: 486 OK (skipped=1), 3 consecutive green runs.