Skip to content

refactor(tests): dedupe integration harness, drop dead scaffolding - #42

Merged
RaoulSchaffranek merged 1 commit into
mainfrom
refactor/test-suite-dedup
Jul 23, 2026
Merged

refactor(tests): dedupe integration harness, drop dead scaffolding#42
RaoulSchaffranek merged 1 commit into
mainfrom
refactor/test-suite-dedup

Conversation

@RaoulSchaffranek

Copy link
Copy Markdown
Member

Summary

Post-merge cleanup of the test suite. The feature PRs merged today (get-events, tx-result-xdr, simulate-transaction, get-ledger-entries, trace-transaction) each brought their own copy of the integration harness, so the fixtures, RPC plumbing, and deploy helpers had drifted across files. This consolidates them and removes leftover cookiecutter scaffolding.

Changes

  • New src/tests/integration/conftest.py — the shared server fixture (was duplicated verbatim in both integration files), the HTTP/JSON-RPC plumbing (_rpc/_post/_post_raw/wat_to_wasm/_find_free_port/_wait_for_server), the spec-shape predicates, and composable transaction helpers (send_tx, fund_account, deploy_contract, make_invoker, deploy_and_get_invoker).
  • test_server.py / test_get_events.py import from conftest instead of redefining. The ~7 inline send/builder closures and the five separate deploy helpers collapse onto the shared primitives.
  • Unify the duplicated _is_number / _is_json_number predicate.
  • Delete komet_node/hello.py (untouched cookiecutter scaffolding, used nowhere in the product) and its two duplicate test_hello tests.
  • Strengthen test_call_tx_with_args — it now round-trips each decoded argument from the trace's callContract frame back through scval_from_json and asserts equality with the sent SCVals, so a decoding bug is caught even when the transaction still succeeds. Previously it only asserted SUCCESS.

Net -423/+93 across the edited files, with the shared logic centralised in the new 216-line conftest.

Verification

  • make check clean (flake8, mypy, autoflake, isort, black).
  • The 78 tests that don't deploy a contract pass — exercising the new conftest fixture, send_tx, fund_account, and the predicate unification.
  • No behaviour change: the contract upload/deploy/invoke tests fail only on a pre-existing local toolchain skew (kdist writes compiled.json v3, installed pyk expects v4 → ValueError: Invalid version: 3 in interpreter._inject_program), which reproduces identically on main. CI, running the pinned toolchain, is unaffected.

The feature PRs merged today each brought their own copy of the test
harness. Consolidate it and remove leftover template scaffolding.

- Add src/tests/integration/conftest.py holding the shared server
  fixture, the HTTP/JSON-RPC plumbing, the spec-shape predicates, and
  composable transaction helpers (send_tx, fund_account, deploy_contract,
  make_invoker, deploy_and_get_invoker).
- test_server.py and test_get_events.py now import these instead of
  redefining them; the ~7 inline send/builder closures and the five
  separate deploy helpers collapse onto the shared primitives.
- Unify the duplicated _is_number / _is_json_number predicate.
- Delete komet_node/hello.py (untouched cookiecutter scaffolding, used
  nowhere in the product) and its two duplicate test_hello tests.
- Strengthen test_call_tx_with_args: it now round-trips each decoded
  argument from the trace's callContract frame back through
  scval_from_json and asserts equality with the sent SCVals, so a
  decoding bug is caught even when the transaction still succeeds
  (previously it only asserted SUCCESS).

No behavior change: the 78 non-injection tests pass; the contract
upload/deploy/invoke tests fail only on the pre-existing kdist
compiled.json v3 vs pyk v4 toolchain skew, identically on main.
@RaoulSchaffranek
RaoulSchaffranek merged commit 07d5627 into main Jul 23, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant