Repository navigation
test(python): ask the pty REPL cases for JSON, as the rust ones already do - #1030
Merged
Merged
Conversation
…dy do
Five cases in `repl_interactive_test.py` assert `[{"n":41}]` and have been
red since `060576f` taught the CLI to lay rows out as a table when stdout is
a terminal. The tests landed 55 minutes earlier and were never revisited.
The table is the intended output, not a regression: `docs/reference/cli.md`
documents `auto` as "table if stdout is a terminal, JSON otherwise", and
`060576f` moved the rust pty cases onto `--format json` for exactly this
reason -- on a terminal they would otherwise be rendering tests as well as
editor tests. It added a separate case for the default it gave up. The
python suite was simply missed in that pass.
So the fix is the same one: the fixture opens the REPL with `--format json`.
These cases are about the up arrow, the history file, `Ctrl+C`, and the
continuation prompt; none of them has an opinion about layout, and the table
default stays covered by `packages/rust/tests/repl_tty_e2e.rs`.
This unblocks `just e2e-attest-python`, which runs the whole suite and needs
exit 0 to write a receipt.
`--format json` on a history test reads as cruft, and deleting it puts the five cases straight back on the table layout they have no opinion about.
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.
Five pty cases in
packages/python/tests/e2e/repl_interactive_test.pyassert[{"n":41}]and have been red since060576ftaught the CLI to lay rows out as a table when stdout is a terminal.Fixes #1027
Which side was wrong
The tests. The table is the intended REPL output, and there is direct evidence rather than inference:
docs/reference/cli.md("Output format") states it as the contract:auto(the default) renders "Table if stdout is a terminal, JSON otherwise", and gives the table layout — aligned columns, a rule under the header, a row count — as the documented shape. The docs are neither silent nor contradictory here.060576f's own message says the rust pty cases were moved onto--format jsonin that same commit, "on a terminal they would otherwise read rows through a table layout, making every one of them a rendering test as well as a termination test", and that it added "one new case cover[ing] the default they gave up".packages/rust/tests/repl_tty_e2e.rscarries both the--format jsonsessions and adefault_format()case asserting the table.Manual confirmation of both directions at a real pty:
So no REPL change. Not a regression, no behavior change, and therefore no red-CI step: this is a stale-assertion repair.
What changed
One line. The
open_replfixture opens the REPL with--format json, matching the rust pty suite. These cases are about the up arrow, the history file,Ctrl+C, and the continuation prompt; none has an opinion about layout, and the table default stays covered bypackages/rust/tests/repl_tty_e2e.rs.The alternative — rewriting five assertions against the table — was rejected as both larger and weaker: the rendered
41sits on a screen that still shows the typedSELECT 41 AS n;, so a text match on the cell would pass for the wrong reason.One line of comment rides along, because the reason a history test pins JSON is not derivable from the line and a future reader could plausibly delete it and re-break the suite:
# A tty gets a table; JSON keeps these cases on rows, not layout.E2E Verification
packages/python/e2e-attestations/<branch>.jsonreceipt written ifpackages/pythonchanged (just e2e-attest-python) — not owed, see belowpackages/ts/e2e-attestations/<branch>.jsonreceipt written ifpackages/tschanged (just e2e-attest-ts) — N/Acargo build -p dirsql --features cli,uv run maturin develop,just test-e2e37 passed in 12.98s(exit 0). Before the change:5 failed, the exact five named in REPL e2e tests still assert JSON output after table rendering landed #1027.No receipt: the
python-sdkjob scopese2e-verifytosource: packages/python/dirsqlplus[e2e].extra_scope = ["packages/rust/src", "packages/python/src"]. This diff touches onlypackages/python/tests/e2e/, so the gate owes nothing. (Also noting the localtesting-conventionson PATH is 0.0.85, well behind the 0.0.111 CI uses — not exercised here, but relevant to anyone who does need a receipt.)Changelog / Migrations
changelog_gate/decide.pyexcludes anything under a package'stests/directory from "non-test source", and this diff is one test file.PARITY.mduntouched: no SDK public API changed.CI
The only failure this branch ever had was the shared
python-sdk / Static checks (python)red that hitmainand every open PR when testing-conventions 0.0.111 (moving@v0) addedunit one-function-per-fileandintegration lint'sno-first-party-patch. #1023 fixed both and has merged;origin/mainis merged in here (clean, no conflicts) and the branch carries no defect of its own.Verified locally on the merged tree with
just preflight --gate one-function-per-file --gate integration-lint --gate unit-lint --gate colocated-testagainst testing-conventions 0.0.111: 0 failing pairs. The newmax_lines = 100rule cannot bite this diff — it scanspackages/python/dirsql, and the diff is one file underpackages/python/tests/e2e/.python-sdk / E2E attestation freshness (e2e verify)passes, confirming no receipt is owed for this diff.