Skip to content
Open
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
3 changes: 2 additions & 1 deletion mypy/dmypy_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -769,7 +769,8 @@ def find_reachable_changed_modules(
state = graph[nxt.module]
ancestors = state.ancestors or []
for dep in state.dependencies + ancestors:
if dep not in seen:
# Namespace package ancestors don't always have a graph node.
if dep not in seen and dep in graph:
seen.add(dep)
worklist.append(BuildSource(graph[dep].path, graph[dep].id, followed=True))
return changed, new_files
Expand Down
26 changes: 26 additions & 0 deletions test-data/unit/daemon.test
Original file line number Diff line number Diff line change
Expand Up @@ -343,6 +343,32 @@ $ {python} -c "import sys; sys.stdout.write(open('log').read())"
-- whether the source file got rehashed, which we don't want it to have been.
$ {python} -c "x = open('.mypy_cache/3.11/bar.meta.ff', 'rb').read(); y = open('asdf.ff', 'rb').read(); assert x == y"

[case testDaemonFineGrainedCacheNamespacePackage]
$ mypy --cache-fine-grained --hide-error-codes src
src/pkg/nspkg/mod.py:1: error: Incompatible types in assignment (expression has type "str", variable has type "int")
Found 1 error in 1 file (checked 2 source files)
== Return code: 1
$ dmypy run -- --use-fine-grained-cache
Daemon started
Success: no issues found in 2 source files
$ {python} -c "print('a: int = ' + repr('changed'))" >src/pkg/nspkg/mod.py
$ dmypy run -- --use-fine-grained-cache
src/pkg/nspkg/mod.py:1: error: Incompatible types in assignment (expression has type "str", variable has type "int")
Found 1 error in 1 file (checked 2 source files)
== Return code: 1
$ dmypy run -- --use-fine-grained-cache
src/pkg/nspkg/mod.py:1: error: Incompatible types in assignment (expression has type "str", variable has type "int")
Found 1 error in 1 file (checked 2 source files)
== Return code: 1
$ dmypy stop
Daemon stopped
[file src/pkg/__init__.py]
[file src/pkg/nspkg/mod.py]
a: int = ""
[file mypy.ini]
\[mypy]
files = src/

[case testDaemonSuggest]
$ dmypy start --log-file log.txt -- --follow-imports=error --no-error-summary
Daemon started
Expand Down
Loading