From c52104da38070a811ae27bc23f88fe3795ea798f Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN Date: Thu, 20 Aug 2026 10:56:43 -0400 Subject: [PATCH] Derive two TUI path expectations from Path instead of hardcoding POSIX MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two of the four Windows TUI failures are literal `/tmp/...` comparisons against paths the app echoes as the platform renders them — on Windows "\tmp\seedpass-db-export.enc", which no POSIX literal will ever match. The expected strings now come from Path, which is a no-op on Linux and macOS (verified: all 91 tests in both files still pass locally) and correct on Windows. The other two are left red on purpose. One raises FileNotFoundError reading back an `export-field nsec` target that was never written; the other asserts False after `doc-export`. Both depend on palette argument parsing and file writing on Windows, which I cannot reproduce here — and a fix I cannot run is a guess dressed as a change. They are named in TODO.md instead. Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_01Vtx94nXDmNgXEeThUZP4QN --- TODO.md | 34 +++++++++++-------- src/tests/test_tui_v2_textual_interactions.py | 13 ++++--- src/tests/test_tui_v3_smoke.py | 5 ++- 3 files changed, 32 insertions(+), 20 deletions(-) diff --git a/TODO.md b/TODO.md index 07aa3727..b97d0a3c 100644 --- a/TODO.md +++ b/TODO.md @@ -253,22 +253,26 @@ everything still open, in the order it should be tackled. deliberately with the sync round-trip re-validated against a real relay rather than folded into unrelated work. (Found 2026-08-20 on the first CI run of this branch.) - - [ ] **Four TUI tests fail on Windows, and only Windows ever runs - them.** Surfaced 2026-08-20 once the Tests workflow could report - a Windows failure at all (see below). All four assume POSIX - paths: `test_tui2_textual_palette_profiles_and_settings` and - `test_tui3_change_password_and_seed_backup_flows_use_vault_service` - compare against literal `/tmp/...` strings while the app echoes - the platform-normalized `\tmp\...`; - `test_tui2_textual_copy_command_for_core_and_advanced_fields` - dies with FileNotFoundError on an `export-field` target; and - `test_tui2_textual_palette_notes_tags_fields_and_doc_export` - asserts False on a doc-export path. + - [ ] **Two TUI tests still fail on Windows, and only Windows ever runs + them.** Surfaced 2026-08-20 once the Tests workflow could report a + Windows failure at all (see below). Four failed; two were literal + `/tmp/...` comparisons against paths the app echoes + platform-normalized, and those are fixed by deriving the expected + string from `Path` — a no-op on POSIX, verified locally. - They are left failing rather than patched blind: reproducing them - needs a Windows host, and guessing at path-normalization and - palette-argument parsing would mean changing tests to match an - assumption instead of a behaviour. + The remaining two need a Windows host and are deliberately not + patched blind: + + - `test_tui2_textual_copy_command_for_core_and_advanced_fields` + raises FileNotFoundError reading back an `export-field nsec` + target that was never written. + - `test_tui2_textual_palette_notes_tags_fields_and_doc_export` + asserts False after `doc-export`. + + Both depend on palette argument parsing and file writing on + Windows. Guessing at either would mean changing a test to match an + assumption rather than a behaviour, so they are left red and + named. Note how this interacts with the textual item below: because textual is undeclared, these tests SKIP on Linux and macOS and run diff --git a/src/tests/test_tui_v2_textual_interactions.py b/src/tests/test_tui_v2_textual_interactions.py index 1b7d0917..840399ce 100644 --- a/src/tests/test_tui_v2_textual_interactions.py +++ b/src/tests/test_tui_v2_textual_interactions.py @@ -2657,15 +2657,20 @@ async def test_tui2_textual_profiles_and_settings_palette_commands() -> None: await pilot.pause() assert "Exported TOTP entries to" in _status_text(app) + # The app echoes the path as the platform renders it, so derive the + # expected text from Path rather than hardcoding the POSIX form -- + # on Windows this string is "\\tmp\\seedpass-db-export.enc" and the + # literal comparison failed there while passing everywhere else. + db_path = Path("/tmp/seedpass-db-export.enc") app._run_palette_command("db-export /tmp/seedpass-db-export.enc") await pilot.pause() - assert Path("/tmp/seedpass-db-export.enc") in vault.exported - assert "Database exported to /tmp/seedpass-db-export.enc" in _status_text(app) + assert db_path in vault.exported + assert f"Database exported to {db_path}" in _status_text(app) app._run_palette_command("db-import /tmp/seedpass-db-export.enc") await pilot.pause() - assert Path("/tmp/seedpass-db-export.enc") in vault.imported - assert "Database imported from /tmp/seedpass-db-export.enc" in _status_text(app) + assert db_path in vault.imported + assert f"Database imported from {db_path}" in _status_text(app) app._run_palette_command( "parent-seed-backup /tmp/seedpass-parent-backup.enc pass123" diff --git a/src/tests/test_tui_v3_smoke.py b/src/tests/test_tui_v3_smoke.py index 46bc858b..708c2dc9 100644 --- a/src/tests/test_tui_v3_smoke.py +++ b/src/tests/test_tui_v3_smoke.py @@ -1,5 +1,6 @@ from __future__ import annotations +from pathlib import Path from types import SimpleNamespace import pytest @@ -662,9 +663,11 @@ async def test_tui3_change_password_and_seed_backup_flows_use_vault_service() -> await pilot.pause() assert vault.changed_passwords == [("old-pass", "new-pass")] + # The processor normalizes the path through Path, so compare against + # the platform's rendering of it rather than the POSIX literal. app.processor.execute("backup-parent-seed /tmp/seed-backup.enc pw123") await pilot.pause() - assert vault.backup_requests[-1] == ("/tmp/seed-backup.enc", "pw123") + assert vault.backup_requests[-1] == (str(Path("/tmp/seed-backup.enc")), "pw123") app.processor.execute("backup-parent-seed") await pilot.pause()