Repository navigation
Conversation
There was a problem hiding this comment.
I don't understand the context of this test. Why does it use chmod to begin with? If it's about disabling access to an input file mid-merge, you can just delete the file. Or trigger a write failure in some other way.
There was a problem hiding this comment.
I don't know either. Might be no particular reason.
There was a problem hiding this comment.
Good question, the comment didn't explain it. The failure must happen after write has created merged.nxs.partial, i.e. when opening the second input, so the cleanup is actually exercised. Deleting the file fails earlier: the size/mtime check at the start of write raises FileNotFoundError before .partial exists, and the test would pass even with the cleanup removed (checked). That's why chmod, which keeps size and mtime.
6e73d10 replaces chmod with overwriting the file with zeros and restoring its mtime, which should also work on Windows, so the skip is gone. The write docstring now also says why a partial output must never exist: it starts as a copy of the first run's file and looks valid.
|
Added @SimonHeybrock as reviewer to answer the question about the test context. |
chmod(0) does not prevent reads on Windows. Overwrite the second input with zeros of the same size and restore its modification time instead: opening it fails after the partial file exists, while the size and modification time check in write still passes. Deleting the file would not work, since that check would then fail before the partial file is created and the cleanup would go untested. Document in the write docstring why a partial output must not exist. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fixes #880
The test doesn't work on windows because
chmod(0)still leaves the file readable.