Skip to content

fix: make the remaining test suite pass on Windows#335

Open
ShreyanshVaibhaw wants to merge 1 commit into
huggingface:mainfrom
ShreyanshVaibhaw:fix/windows-test-suite-remaining
Open

fix: make the remaining test suite pass on Windows#335
ShreyanshVaibhaw wants to merge 1 commit into
huggingface:mainfrom
ShreyanshVaibhaw:fix/windows-test-suite-remaining

Conversation

@ShreyanshVaibhaw

Copy link
Copy Markdown
Contributor

Summary

Follow-up to #326 (merged), which fixed tests/test_coding_session.py on Windows. Running the rest of the suite on Windows surfaced 9 more failures on unmodified main, in three categories. This PR fixes all of them; the full suite on Windows now reports 730 passed, 6 skipped, 0 failed. Test-only change - no product code touched, POSIX runs unaffected.

Root causes and fixes

1. Bash-specific tests (3 tests, test_coding_tools.py)

test_create_coding_tools_applies_shell_command_prefix, test_bash_tool_applies_opt_in_shell_command_prefix, and test_bash_tool_cancellation_kills_shell_children rely on bash behavior: shell_command_prefix only routes through bash on POSIX (os.name == "posix" branch in create_bash_tool), and sleep 1 & wait is bash job control. Marked skipif(sys.platform == "win32") with a requires_posix_shell marker, matching the pattern accepted in #326.

2. POSIX permission bits (1 test, test_credentials.py)

test_file_credential_store_round_trips_and_sets_private_permissions asserts S_IMODE(...) == 0o600 after chmod(0o600), but Windows filesystems do not honor those bits (stat reports 0o666). The round-trip assertions still run everywhere; only the permission-bit check is now gated to POSIX.

3. Path-separator assumptions (5 tests, test_system_prompt.py + test_tui_app.py)

Two opposite mismatches:

  • build_system_prompt deliberately normalizes the cwd to forward slashes on every platform (_format_path), but the test expected the native str(tmp_path) form. The expectation now applies the same normalization.
  • Four TUI tests hardcoded forward-slash paths (/workspace/project, .agents/AGENTS.md, export/resume paths) where the product renders str(Path(...)) with native separators. Expectations now derive from Path so they are correct on every platform.

Notes

  • The HOME-only monkeypatch pattern flagged in Test suite fails on Windows and mutates the developer's real ~/.tau settings #325 for test_cli.py / test_tui_app.py no longer exists on current main, so there was nothing to extend there.
  • test_streaming_code_block_hides_horizontal_scrollbar_until_finalized failed once during the first full-suite run but passed 5 consecutive subsequent runs (isolated and full-file); it appears to be a rare timing flake unrelated to this change, so it is not touched here.

Validation

  • Before: 9 failed across test_coding_tools.py, test_credentials.py, test_system_prompt.py, test_tui_app.py (Windows 11, Python 3.12.7, current main).
  • After: uv run pytest tests/ -> 730 passed, 6 skipped (all POSIX-only, explicitly marked), 0 failed.
  • ruff check tests/ clean.

🤖 Generated with Claude Code

Follow-up to huggingface#326, which fixed test_coding_session.py. The rest of the
suite had 9 more Windows failures in three categories:

1. Bash-specific tests (test_coding_tools.py): shell_command_prefix
   routing and job control (sleep & wait) only apply on POSIX, so the
   three tests exercising them are now skipif win32, matching the
   markers added to test_coding_session.py in huggingface#326.

2. POSIX permission bits (test_credentials.py): chmod(0o600) cannot be
   asserted via S_IMODE on Windows filesystems, so the assertion is
   now guarded to POSIX.

3. Path-separator assumptions (test_system_prompt.py, test_tui_app.py):
   build_system_prompt normalizes the cwd to forward slashes on every
   platform while the test expected the native form; four TUI tests
   expected the opposite - hardcoded forward-slash paths where the
   product renders str(Path(...)) with native separators. Expectations
   now derive from the same formatting the product uses.
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