Skip to content

Commit 4a88a07

Browse files
committed
Prove possibly-undefined errors disappear
This test fails with the error: AssertionError: Command 3 (dmypy check -- bar.py) did not give expected output --- Captured stderr call --- Expected: bar.py:4: error: Name "a" may be undefined [possibly-undefined] (diff) == Return code: 1 (diff) Actual: (empty) This test illustrates that possibly-undefined errors currently disappear in the same way that 'Unused "type: ignore"' errors do as described in python#9655. Ref: python#9655
1 parent ef5a7ce commit 4a88a07

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

Diff for: test-data/unit/daemon.test

+19
Original file line numberDiff line numberDiff line change
@@ -649,3 +649,22 @@ bar.py:2: error: "type: ignore" comment without error code [ignore-without-code
649649
[file bar.py]
650650
from foo.empty import *
651651
a = 1 # type: ignore
652+
653+
[case testPossiblyUndefinedVarsPreservedAfterRerun]
654+
-- Regression test for https://github.com/python/mypy/issues/9655
655+
$ dmypy start -- --enable-error-code possibly-undefined --no-error-summary
656+
Daemon started
657+
$ dmypy check -- bar.py
658+
bar.py:4: error: Name "a" may be undefined [possibly-undefined]
659+
== Return code: 1
660+
$ dmypy check -- bar.py
661+
bar.py:4: error: Name "a" may be undefined [possibly-undefined]
662+
== Return code: 1
663+
664+
[file foo/__init__.py]
665+
[file foo/empty.py]
666+
[file bar.py]
667+
from foo.empty import *
668+
if False:
669+
a = 1
670+
a

0 commit comments

Comments
 (0)