Skip to content

Commit

Permalink
Add test to demonstrate issue python#9655
Browse files Browse the repository at this point in the history
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
  • Loading branch information
meshy committed Mar 4, 2023
1 parent 456dcbd commit b4569fa
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test-data/unit/daemon.test
Original file line number Diff line number Diff line change
Expand Up @@ -522,3 +522,20 @@ class A:
x: int
class B:
x: int

[case testUnusedTypeIgnorePreservedAfterUpdate]
-- Regression test for https://github.com/python/mypy/issues/9655
$ dmypy start -- --warn-unused-ignores --no-error-summary
Daemon started
$ dmypy check -- bar.py
bar.py:2: error: Unused "type: ignore" comment
== Return code: 1
$ dmypy check -- bar.py
bar.py:2: error: Unused "type: ignore" comment
== Return code: 1

[file foo/__init__.py]
[file foo/empty.py]
[file bar.py]
from foo.empty import *
a = 1 # type: ignore

0 comments on commit b4569fa

Please sign in to comment.