e2e: move the cases from bash to pytest #97

Open
opened 2026-10-27 23:03:04 +00:00 by claude-bot · 1 comment
Collaborator

Owner's suggestion (PR #90): the e2e harness (tools/e2e/: lib.sh 560 lines, run.sh, 24 cases in cases/*.sh) would be easier to read, extend and debug in pytest (or similar) than in bash.

What bash costs today:

  • Waiting is counting log lines (e2e_count, e2e_wait '<pattern>' $((seen + 1))); a helper that waits inside another must keep its own local e2e_seen. In Python: a log reader object with wait_for(pattern, after=mark).
  • Positions come back as "x y" strings word-split into e2e_tap $(e2e_last …); quoting slips fail silently.
  • No per-case setup/teardown; isolation and cleanup are hand-written traps. pytest fixtures (app, sword_dir, repo_server, offline) would carry that, and -k / markers replace E2E_CASES.
  • Failures say only the last pattern awaited; pytest's assertion output and a saved log/screenshot per failure would say more.

Keep:

  • The same black-box approach: Xvfb, xdotool (or python-xlib), the app's utsb: … console hooks. No test-only code in the app beyond those hooks.
  • cargo make e2e-docker, cargo make shots, CI's e2e job and the image (ut-app-ci); add python3-pytest to the image if it isn't there. repo-server.py and xwd2png.py are already Python and fold in.
  • Every case passing before and after; port case by case behind one runner so both kinds run until the last bash case is gone.

Trunk (tools/e2e/, .forgejo/workflows/, the CI image): full review. Could for v0.1: the bash works; this pays off as cases grow (v0.2 adds many).

Owner's suggestion (PR #90): the e2e harness (`tools/e2e/`: `lib.sh` 560 lines, `run.sh`, 24 cases in `cases/*.sh`) would be easier to read, extend and debug in pytest (or similar) than in bash. What bash costs today: - Waiting is counting log lines (`e2e_count`, `e2e_wait '<pattern>' $((seen + 1))`); a helper that waits inside another must keep its own `local e2e_seen`. In Python: a log reader object with `wait_for(pattern, after=mark)`. - Positions come back as `"x y"` strings word-split into `e2e_tap $(e2e_last …)`; quoting slips fail silently. - No per-case setup/teardown; isolation and cleanup are hand-written traps. pytest fixtures (`app`, `sword_dir`, `repo_server`, `offline`) would carry that, and `-k` / markers replace `E2E_CASES`. - Failures say only the last pattern awaited; pytest's assertion output and a saved log/screenshot per failure would say more. Keep: - The same black-box approach: Xvfb, xdotool (or python-xlib), the app's `utsb: …` console hooks. No test-only code in the app beyond those hooks. - `cargo make e2e-docker`, `cargo make shots`, CI's `e2e` job and the image (`ut-app-ci`); add `python3-pytest` to the image if it isn't there. `repo-server.py` and `xwd2png.py` are already Python and fold in. - Every case passing before and after; port case by case behind one runner so both kinds run until the last bash case is gone. Trunk (`tools/e2e/`, `.forgejo/workflows/`, the CI image): full review. Could for v0.1: the bash works; this pays off as cases grow (v0.2 adds many).
Author
Collaborator

The owner has decided this is required for 0.1.0, despite the priority/Could label: the e2e cases move off bash before the release.

Scope, also the owner's decision: zero or almost no bash in formal testing code. That includes tools/mem-check/run.sh, so tools/e2e/lib.sh is deleted rather than trimmed. Any shell left is a thin entry point with no test logic.

Progress: branch feat/e2e-pytest (d82879c, no PR yet) makes pytest the runner, with a Python harness in tools/e2e/harness/. restore and picker-back are ported and the other 43 cases run through a wrapper test until they are ported in batches.

🤖 Generated with Claude Code

The owner has decided this is required for 0.1.0, despite the `priority/Could` label: the e2e cases move off bash before the release. Scope, also the owner's decision: zero or almost no bash in formal testing code. That includes `tools/mem-check/run.sh`, so `tools/e2e/lib.sh` is deleted rather than trimmed. Any shell left is a thin entry point with no test logic. Progress: branch `feat/e2e-pytest` (d82879c, no PR yet) makes pytest the runner, with a Python harness in `tools/e2e/harness/`. `restore` and `picker-back` are ported and the other 43 cases run through a wrapper test until they are ported in batches. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
schaefera/utStudyBIble#97
No description provided.