Skip to content

Commit 5d0b42f

Browse files
committed
Add test to demonstrate issue #9655
This test currently fails with this error: AssertionError: Command 3 (dmypy check -- bar.py) did not give expected output --- Captured stderr call --- Expected: bar.py:2: error: Unused "type: ignore" comment (diff) == Return code: 1 (diff) Actual: (empty) It demonstrates a bug that when an module is removed using `FineGrainedBuildManager.update` because it is not "seen" by `fine_grained_increment_follow_imports`, then "unused type: ignore" warnings disappear from subsequent checks. Ref: #9655
1 parent 905c2cb commit 5d0b42f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

test-data/unit/daemon.test

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -522,3 +522,20 @@ class A:
522522
x: int
523523
class B:
524524
x: int
525+
526+
[case testUnusedTypeIgnorePreservedOnRerun]
527+
-- Regression test for https://github.com/python/mypy/issues/9655
528+
$ dmypy start -- --warn-unused-ignores --no-error-summary
529+
Daemon started
530+
$ dmypy check -- bar.py
531+
bar.py:2: error: Unused "type: ignore" comment
532+
== Return code: 1
533+
$ dmypy check -- bar.py
534+
bar.py:2: error: Unused "type: ignore" comment
535+
== Return code: 1
536+
537+
[file foo/__init__.py]
538+
[file foo/empty.py]
539+
[file bar.py]
540+
from foo.empty import *
541+
a = 1 # type: ignore

0 commit comments

Comments
 (0)