Skip to content

Commit 437c90f

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 #9655. Ref: #9655
1 parent d2d8a49 commit 437c90f

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

test-data/unit/daemon.test

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -605,3 +605,22 @@ bar.py:2: error: "type: ignore" comment without error code [ignore-without-code
605605
[file bar.py]
606606
from foo.empty import *
607607
a = 1 # type: ignore
608+
609+
[case testPossiblyUndefinedVarsPreservedAfterUpdate]
610+
-- Regression test for https://github.com/python/mypy/issues/9655
611+
$ dmypy start -- --enable-error-code possibly-undefined --no-error-summary
612+
Daemon started
613+
$ dmypy check -- bar.py
614+
bar.py:4: error: Name "a" may be undefined [possibly-undefined]
615+
== Return code: 1
616+
$ dmypy check -- bar.py
617+
bar.py:4: error: Name "a" may be undefined [possibly-undefined]
618+
== Return code: 1
619+
620+
[file foo/__init__.py]
621+
[file foo/empty.py]
622+
[file bar.py]
623+
from foo.empty import *
624+
if False:
625+
a = 1
626+
a

0 commit comments

Comments
 (0)