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 = (