FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

test(project): cover deterministic native fingerprint hashing by HarshRajSinghania · Pull Request #98 · pythonnative/pythonnative · GitHub

Repository navigation

test(project): cover deterministic native fingerprint hashing - #98

Merged
owenthcarey merged 3 commits into
pythonnative:mainfrom
HarshRajSinghania:test/fingerprint-hash-tree
Sep 29, 2026
Merged

owenthcarey merged 3 commits into
pythonnative:mainfrom
HarshRajSinghania:test/fingerprint-hash-tree

Conversation

Copy link
Copy Markdown
Contributor

Summary

Adds direct tests for hash_tree() so native fingerprint hashing is covered without going through the CLI or a native build.

Closes #91.

Motivation

#91 notes that tests/test_cli.py only checks artifact reuse when a fingerprint matches. There were no direct tests for the hashing contract: path+content stability, ignore lists, mtime independence, missing/empty roots, and single-file hashing.

Implementation

  • New tests/project/test_fingerprint.py.
  • Uses small tmp_path fixtures and compares hashes to each other rather than hard-coded digests.
  • Covers ignored dirs (build, __pycache__, .git) and suffixes (.pyc, .DS_Store).
  • Uses os.utime() to confirm mtime-only changes do not affect the digest.

Testing

This environment has Python 3.12; the project requires 3.13 (class Route[P: RouteParams = ...]), so uv run pytest / ./scripts/check.sh could not be run here.

The six cases were executed against hash_tree by loading src/pythonnative/project/fingerprint.py with a stub config module on Python 3.12. All assertions passed:

  • identical trees under different roots / creation order
  • byte change and rename change the hash
  • mtime-only change does not
  • ignored paths do not; a new source file does
  • missing root and empty directory share the empty digest
  • hashing a single file is path-root independent for the same basename+bytes

owenthcarey merged commit 9f4e907 into pythonnative:main Sep 29, 2026
33 checks passed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
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.

Add direct tests for deterministic native fingerprint hashing

2 participants


Back | FazBrowse Home | New Git URL