Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions .github/workflows/hash_git_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,24 +89,15 @@ def compute_adler32(repo_path: Path, files: list[str], extra_paths: list[Path] |
if file_path.name == "uv.lock":
checksum = zlib.adler32(get_uv_lock_bytes_for_hashing(file_path), checksum)
else:
with file_path.open("rb") as f:
while True:
chunk = f.read(4096)
if not chunk:
break
checksum = zlib.adler32(chunk, checksum)
# Normalize CRLF to LF so the checksum is identical on Windows (autocrlf) and Linux CI checkouts.
checksum = zlib.adler32(file_path.read_bytes().replace(b"\r\n", b"\n"), checksum)
Comment thread
coderabbitai[bot] marked this conversation as resolved.
except IsADirectoryError:
# Ignore symlinks that on windows sometimes get confused as being directories
continue

for extra_path in sorted(extra_paths or []):
checksum = zlib.adler32(str(extra_path).encode("utf-8"), checksum)
with extra_path.open("rb") as f:
while True:
chunk = f.read(4096)
if not chunk:
break
checksum = zlib.adler32(chunk, checksum)
checksum = zlib.adler32(extra_path.read_bytes().replace(b"\r\n", b"\n"), checksum)

return checksum

Expand Down
1 change: 1 addition & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ This project is a Copier template used to generate other copier templates. It is
### Python Testing

- Keep every behavioral `assert` inside the test function body — never factor assertions into helper functions or fixtures. pytest's assertion rewriting (the rich failure diff) only applies to asserts located in the test module (or conftest/registered plugins), so an `assert` hidden in an ordinary helper reports an opaque failure with no useful diff.
- Do not apply the keyword-only parameter rule (`*`) to test functions or fixtures — pytest injects its parameters, so `*` has no effect.
- When using `mocker.spy` on a class-level method (including inherited ones), the spy records the unbound call, so assertions need `ANY` as the first argument to match self: `spy.assert_called_once_with(ANY, expected_arg)`
- Before writing new mock/spy helpers, check the `tests/unit/` folder for pre-built helpers in files like `fixtures.py` or `*mocks.py`
- When a test needs a fixture only for its side effects (not its return value), use `@pytest.mark.usefixtures(fixture_name.__name__)` instead of adding an unused parameter with a noqa comment
Expand Down