Skip to content

Commit 6094fc4

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 1831cbd commit 6094fc4

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
@@ -556,3 +556,22 @@ bar.py:2: error: "type: ignore" comment without error code [ignore-without-code
556556
[file bar.py]
557557
from foo.empty import *
558558
a = 1 # type: ignore
559+
560+
[case testPossiblyUndefinedVarsPreservedAfterUpdate]
561+
-- Regression test for https://github.com/python/mypy/issues/9655
562+
$ dmypy start -- --enable-error-code possibly-undefined --no-error-summary
563+
Daemon started
564+
$ dmypy check -- bar.py
565+
bar.py:4: error: Name "a" may be undefined [possibly-undefined]
566+
== Return code: 1
567+
$ dmypy check -- bar.py
568+
bar.py:4: error: Name "a" may be undefined [possibly-undefined]
569+
== Return code: 1
570+
571+
[file foo/__init__.py]
572+
[file foo/empty.py]
573+
[file bar.py]
574+
from foo.empty import *
575+
if False:
576+
a = 1
577+
a

0 commit comments

Comments
 (0)