Skip to content

Commit 84dba16

Browse files
committed
Add a regression test for type ignores in dmypy
This catches a regression caused by the previous attempt to fix python#9655 where "type: ignore" comments are erroneously marked as unused in re-runs of dmypy. Ref: python#14835
1 parent cd4b446 commit 84dba16

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

test-data/unit/daemon.test

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -707,3 +707,24 @@ from foo.main import *
707707
[file foo/main.py]
708708
from foo import does_not_exist
709709
from unused.submodule import *
710+
711+
[case testReturnTypeIgnoreAfterUnknownImport]
712+
-- Return type ignores after unknown imports and unused modules are respected on the second pass.
713+
$ dmypy start -- --warn-unused-ignores --no-error-summary
714+
Daemon started
715+
$ dmypy check -- foo.py
716+
foo.py:2: error: Cannot find implementation or library stub for module named "a_module_which_does_not_exist" [import-not-found]
717+
foo.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
718+
== Return code: 1
719+
$ dmypy check -- foo.py
720+
foo.py:2: error: Cannot find implementation or library stub for module named "a_module_which_does_not_exist" [import-not-found]
721+
foo.py:2: note: See https://mypy.readthedocs.io/en/stable/running_mypy.html#missing-imports
722+
== Return code: 1
723+
724+
[file unused/__init__.py]
725+
[file unused/empty.py]
726+
[file foo.py]
727+
from unused.empty import *
728+
import a_module_which_does_not_exist
729+
def is_foo() -> str:
730+
return True # type: ignore

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy