Skip to content

Commit

Permalink
fix: .cache wasn't ignored correctly in project.__getattr__ (#2078)
Browse files Browse the repository at this point in the history
  • Loading branch information
antazoey committed May 9, 2024
1 parent 22d3cb1 commit dbff699
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/ape/managers/project/types.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import os
from fnmatch import fnmatch
from pathlib import Path
from typing import Any, Dict, List, Optional, Sequence

Expand Down Expand Up @@ -182,7 +183,7 @@ def create_manifest(
else [
p
for p in self.source_paths
if not any(p.match(e) for e in compile_config.exclude)
if not any(fnmatch(p, e) for e in compile_config.exclude)
]
)
)
Expand Down
12 changes: 12 additions & 0 deletions tests/functional/test_project.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,18 @@ def test_create_manifest_empty_files(compilers, mock_compiler, config, ape_caplo
assert f"Compiling '{name}.__mock__'." not in ape_caplog.head


def test_create_manifest_excludes_cache(ape_project):
cachefile = ape_project.contracts_folder / ".cache" / "CacheFile.json"
cachefile2 = ape_project.contracts_folder / ".cache" / "subdir" / "Cache2.json"
cachefile2.parent.mkdir(parents=True)
cachefile.write_text("Doesn't matter")
cachefile2.write_text("Doesn't matter")
manifest = ape_project.create_manifest()
assert isinstance(manifest, PackageManifest)
assert ".cache/CacheFile.json" not in (manifest.sources or {})
assert ".cache/subdir/CacheFile.json" not in (manifest.sources or {})


def test_meta(temp_config, project):
meta_config = {
"meta": {
Expand Down

0 comments on commit dbff699

Please sign in to comment.