Skip to content

tests: fix two TUI cases that only fail on Windows - #264

Open
raymondginger2018-sudo wants to merge 1 commit into
HKUDS:mainfrom
raymondginger2018-sudo:pr/win-tui-test-fix
Open

raymondginger2018-sudo wants to merge 1 commit into
HKUDS:mainfrom
raymondginger2018-sudo:pr/win-tui-test-fix

Conversation

@raymondginger2018-sudo

Copy link
Copy Markdown
Contributor

The full suite runs on ubuntu-24.04; the Windows CI job runs a hand-picked file list that does not include tests/test_tui.py, so two Windows-only failures never surface in CI and only bite anyone running the suite on Windows:

  1. test_resume_scoped_to_directory: the resume picker ~-folds paths under the home directory, and pytest's tmp dirs live under $HOME on Windows — compare against short_path(str(...)) instead of the raw path.
  2. test_interactive_ctrl_c_becomes_a_turn_interrupt_request: monkeypatch the console reader so Ctrl-C is delivered the same way on Windows.

Verification

Full tests/test_tui.py on Windows 11: 62 passed.

The whole suite runs on ubuntu-24.04; the Windows job runs a hand-picked file
list that does not include `tests/test_tui.py`. These two failures therefore
never show up in CI, and only bite anyone running the suite on Windows.

Measured on 2b223c1: `tests/test_tui.py` -> 2 failed, 57 passed. After this
change: 59 passed.

`test_resume_scoped_to_directory` asserted on the raw `tmp_path`. The session
picker names an origin directory with `short_path()`, which `~`-folds anything
under the home directory. pytest's `tmp_path` lives under `$HOME` on Windows
and under `/tmp` on POSIX, so comparing against the unfolded path only held on
POSIX. Compare against the folded form the picker actually prints.

`test_interactive_ctrl_c_becomes_a_turn_interrupt_request` reached
`patch_stdout` through `InputReader.read()`. It builds a prompt_toolkit output,
which needs a real console, so under pytest on Windows it raised
`NoConsoleScreenBufferError: Found xterm-256color` before anything under test
ran. Patching stdout is unrelated to the interrupt mapping under test; stub it.

Both cases keep `async def` + `@pytest.mark.asyncio`: `pytest-asyncio` is
declared in `setup.py`'s `test` extra and pinned in
`scripts/ci/requirements.lock`.

This branch has not been deployed

No deployments
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