Skip to content

Fix Windows CI failures from unclosed file handles#4

Merged
holmboe merged 1 commit intomainfrom
fix/windows-test-file-handles
Mar 30, 2026
Merged

Fix Windows CI failures from unclosed file handles#4
holmboe merged 1 commit intomainfrom
fix/windows-test-file-handles

Conversation

@holmboe
Copy link
Copy Markdown
Contributor

@holmboe holmboe commented Mar 30, 2026

Summary

  • Tests used NamedTemporaryFile with delete=False and called unlink() inside the with block while the file handle was still open — fails on Windows with PermissionError: [WinError 32]
  • Switched tests to use pytest's tmp_path fixture instead, which writes and closes files cleanly
  • Also fixed unclosed data file handles in compile_template()parse_data_args() opens files via Path(filename).open() that were never closed after YAML loading

Test plan

  • All 22 tests pass locally on Linux
  • Windows CI should now pass (previously failed with PermissionError on 8 tests)
  • Lint (ruff check) passes
  • Type check (mypy) passes

🤖 Generated with Claude Code

Tests used NamedTemporaryFile and called unlink() while the file was
still open, which fails on Windows. Switch to pytest tmp_path fixture.

Also close data file handles in compile_template() after YAML loading,
as parse_data_args() opens files that were never closed.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@holmboe holmboe merged commit f4393bb into main Mar 30, 2026
8 checks passed
@holmboe holmboe deleted the fix/windows-test-file-handles branch March 30, 2026 10:28
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