Skip to content

Commit aee1896

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 10dfafe commit aee1896

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
@@ -571,3 +571,20 @@ class A:
571571
x: int
572572
class B:
573573
x: int
574+
575+
[case testUnusedTypeIgnorePreservedOnRerun]
576+
-- Regression test for https://github.com/python/mypy/issues/9655
577+
$ dmypy start -- --warn-unused-ignores --no-error-summary
578+
Daemon started
579+
$ dmypy check -- bar.py
580+
bar.py:2: error: Unused "type: ignore" comment
581+
== Return code: 1
582+
$ dmypy check -- bar.py
583+
bar.py:2: error: Unused "type: ignore" comment
584+
== Return code: 1
585+
586+
[file foo/__init__.py]
587+
[file foo/empty.py]
588+
[file bar.py]
589+
from foo.empty import *
590+
a = 1 # type: ignore

0 commit comments

Comments
 (0)