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
9 changes: 6 additions & 3 deletions mypy/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -1315,13 +1315,16 @@ def delete_cache(id: str, path: str, manager: BuildManager) -> None:
see #4043 for an example.
"""
path = manager.normpath(path)
cache_paths = get_cache_names(id, path, manager)
# We don't delete .deps files on errors, since the dependencies
# are mostly generated from other files and the metadata is
# tracked separately.
meta_path, data_path, _ = get_cache_names(id, path, manager)
cache_paths = [meta_path, data_path]
manager.log('Deleting {} {} {}'.format(id, path, " ".join(x for x in cache_paths if x)))

for filename in cache_paths:
try:
if filename:
manager.metastore.remove(filename)
manager.metastore.remove(filename)
except OSError as e:
if e.errno != errno.ENOENT:
manager.log("Error deleting cache file {}: {}".format(filename, e.strerror))
Expand Down
13 changes: 13 additions & 0 deletions test-data/unit/check-incremental.test
Original file line number Diff line number Diff line change
Expand Up @@ -3630,6 +3630,19 @@ def foo() -> None:
[out2]
tmp/main.py:2: error: "int" has no attribute "foo"

[case testIncrementalFineGrainedCacheError1]
# flags: --cache-fine-grained --no-sqlite-cache
import a
[file a.py]
[file b.py]
x = 0
[file a.py.2]
from b import x
1 + 'lol'
[out]
[out2]
tmp/a.py:2: error: Unsupported operand types for + ("int" and "str")

[case testIncrementalBustedFineGrainedCache1]
# flags: --cache-fine-grained --no-sqlite-cache
import a
Expand Down