Skip to content

Commit b5cc83f

Browse files
committed
Add failing tests showing disappearing errors
This shows two cases where errors disappear from the second run of dmypy. The first shows a way that "unused type ignore" errors can disappear. The case is a little complicated, but I can't yet work out how to make it smaller. The second case shows how "module X has not attribute Y" errors can disappear.
1 parent 94e5df4 commit b5cc83f

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed

test-data/unit/daemon.test

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -668,3 +668,42 @@ from foo.empty import *
668668
if False:
669669
a = 1
670670
a
671+
672+
[case testUnusedTypeIgnorePreservedOnRerunWithIgnoredMissingImports]
673+
$ dmypy start -- --no-error-summary --ignore-missing-imports --warn-unused-ignores
674+
Daemon started
675+
$ dmypy check foo
676+
foo/main.py:3: error: Unused "type: ignore" comment [unused-ignore]
677+
== Return code: 1
678+
$ dmypy check foo
679+
foo/main.py:3: error: Unused "type: ignore" comment [unused-ignore]
680+
== Return code: 1
681+
682+
[file unused/__init__.py]
683+
[file unused/submodule.py]
684+
[file foo/empty.py]
685+
[file foo/__init__.py]
686+
from foo.main import *
687+
from unused.submodule import *
688+
[file foo/main.py]
689+
from foo import empty
690+
from foo.does_not_exist import *
691+
a = 1 # type: ignore
692+
693+
[case testModuleDoesNotExistPreservedOnRerun]
694+
$ dmypy start -- --no-error-summary --ignore-missing-imports
695+
Daemon started
696+
$ dmypy check foo
697+
foo/main.py:1: error: Module "foo" has no attribute "does_not_exist" [attr-defined]
698+
== Return code: 1
699+
$ dmypy check foo
700+
foo/main.py:1: error: Module "foo" has no attribute "does_not_exist" [attr-defined]
701+
== Return code: 1
702+
703+
[file unused/__init__.py]
704+
[file unused/submodule.py]
705+
[file foo/__init__.py]
706+
from foo.main import *
707+
[file foo/main.py]
708+
from foo import does_not_exist
709+
from unused.submodule import *

0 commit comments

Comments
 (0)