diff --git a/mypy/build.py b/mypy/build.py index 3ceb473f0948..733f0685792e 100644 --- a/mypy/build.py +++ b/mypy/build.py @@ -3467,8 +3467,11 @@ def process_stale_scc(graph: Graph, scc: list[str], manager: BuildManager) -> No for id in stale: graph[id].transitive_error = True for id in stale: - errors = manager.errors.file_messages(graph[id].xpath, formatter=manager.error_formatter) - manager.flush_errors(manager.errors.simplify_path(graph[id].xpath), errors, False) + if graph[id].xpath not in manager.errors.ignored_files: + errors = manager.errors.file_messages( + graph[id].xpath, formatter=manager.error_formatter + ) + manager.flush_errors(manager.errors.simplify_path(graph[id].xpath), errors, False) graph[id].write_cache() graph[id].mark_as_rechecked() diff --git a/mypy/errors.py b/mypy/errors.py index 7a937da39c20..d6dcd4e49e13 100644 --- a/mypy/errors.py +++ b/mypy/errors.py @@ -803,7 +803,7 @@ def blocker_module(self) -> str | None: def is_errors_for_file(self, file: str) -> bool: """Are there any errors for the given file?""" - return file in self.error_info_map + return file in self.error_info_map and file not in self.ignored_files def prefer_simple_messages(self) -> bool: """Should we generate simple/fast error messages? diff --git a/test-data/unit/check-incremental.test b/test-data/unit/check-incremental.test index ead896b8e458..24292bce3e21 100644 --- a/test-data/unit/check-incremental.test +++ b/test-data/unit/check-incremental.test @@ -1833,6 +1833,21 @@ main:3: note: Revealed type is "builtins.int" main:3: note: Revealed type is "Any" +[case testIncrementalIgnoreErrors] +# flags: --config-file tmp/mypy.ini +import a +[file a.py] +import module_that_will_be_deleted +[file module_that_will_be_deleted.py] + +[file mypy.ini] +\[mypy] +\[mypy-a] +ignore_errors = True +[delete module_that_will_be_deleted.py.2] +[out1] +[out2] + [case testIncrementalNamedTupleInMethod] from ntcrash import nope [file ntcrash.py]