kimi-cli icon indicating copy to clipboard operation
kimi-cli copied to clipboard

fix(tests): improve Windows cross-platform test compatibility

Open panandicoding opened this issue 4 months ago • 0 comments

Related Issue

N/A (small fix < 100 lines; no prior issue required per CONTRIBUTING.md)

Description

Two Windows cross-platform issues in the test suite:

  1. test_background_tools.py: Path.write_text() without newline="" converts \n to \r\n on Windows, causing last_seen_output_size assertions to fail (28 bytes vs expected 26 bytes).

  2. tests/e2e/: Unconditional import fcntl at module level causes ModuleNotFoundError during test collection on Windows, since fcntl, termios, and pty are Unix-only modules.

Changes

  • Added newline="" to write_text() calls in test helpers _write_task() and _write_agent_task() to ensure consistent byte lengths across platforms.
  • Created tests/e2e/conftest.py with collect_ignore_glob to skip PTY-based e2e tests on Windows.

Note: CI currently only runs tests on Ubuntu, so these issues were not caught previously. These fixes enable local development and testing on Windows without false failures.

Checklist

  • [x] I have read the CONTRIBUTING document.
  • [x] I have linked the related issue, if any.
  • [x] I have added tests that prove my fix is effective or that my feature works.
  • [ ] I have run make gen-changelog to update the changelog.
  • [ ] I have run make gen-docs to update the user documentation.

Open in Devin Review

panandicoding avatar Jul 25 '26 14:07 panandicoding