From a978b9dd8ee8d4c84a6efefc2f05ee66b3805302 Mon Sep 17 00:00:00 2001 From: Trenton H <797416+stumpylog@users.noreply.github.com> Date: Sat, 3 Oct 2026 15:43:04 -0700 Subject: [PATCH] Chore: Make the sample duplicate guard fail on a missing tree Co-Authored-By: Claude Sonnet 5.5 --- src/documents/tests/test_sample_files.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/documents/tests/test_sample_files.py b/src/documents/tests/test_sample_files.py index 04d088d80..6599cf636 100644 --- a/src/documents/tests/test_sample_files.py +++ b/src/documents/tests/test_sample_files.py @@ -39,7 +39,6 @@ def test_install_uses_the_shared_bytes(tmp_path: Path) -> None: APP_SAMPLE_TREES = [ Path(__file__).parent / "samples", Path(__file__).parents[2] / "paperless" / "tests" / "samples", - Path(__file__).parent / "examples", SHARED_SAMPLES_DIR, ] @@ -47,9 +46,12 @@ APP_SAMPLE_TREES = [ def test_no_two_sample_files_have_identical_bytes() -> None: by_hash: dict[str, list[Path]] = defaultdict(list) for tree in APP_SAMPLE_TREES: + assert tree.is_dir(), f"Sample tree does not exist: {tree}" for path in tree.rglob("*"): - if path.is_file(): + # Skip empty placeholders, which would all hash identically + if path.is_file() and path.stat().st_size > 0: by_hash[_sha(path)].append(path) + assert by_hash, "No sample files were found to compare" duplicates = {h: ps for h, ps in by_hash.items() if len(ps) > 1} lines = [" " + ", ".join(str(p) for p in ps) for ps in duplicates.values()] message = (