Skip to content

Commit 1ce2f21

Browse files
committed
Add test to demonstrate issue python#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: python#9655
1 parent f9e8e0b commit 1ce2f21

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
@@ -615,3 +615,20 @@ b: str
615615
from demo.test import a
616616
[file demo/test.py]
617617
a: int
618+
619+
[case testUnusedTypeIgnorePreservedOnRerun]
620+
-- Regression test for https://github.com/python/mypy/issues/9655
621+
$ dmypy start -- --warn-unused-ignores --no-error-summary --hide-error-codes
622+
Daemon started
623+
$ dmypy check -- bar.py
624+
bar.py:2: error: Unused "type: ignore" comment
625+
== Return code: 1
626+
$ dmypy check -- bar.py
627+
bar.py:2: error: Unused "type: ignore" comment
628+
== Return code: 1
629+
630+
[file foo/__init__.py]
631+
[file foo/empty.py]
632+
[file bar.py]
633+
from foo.empty import *
634+
a = 1 # type: ignore

0 commit comments

Comments
 (0)