Skip to content

Commit 65f6bcc

Browse files
another test that would work if enable-all-error-codes was also a per-module option, which I guess it isnt
1 parent ff5f284 commit 65f6bcc

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

test-data/unit/check-flags.test

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2550,6 +2550,29 @@ enable_all_error_codes = True
25502550
\[mypy-tests.*]
25512551
disable_error_code = ignore-without-code
25522552

2553+
[case testSpotCheckEnableAllErrorCodesConfigCountermand]
2554+
# flags: --config-file tmp/mypy.ini
2555+
# This test makes sure that the user can still countermand error codes disables
2556+
# by *using* enable_all_error_codes on a more-specific level.
2557+
import tests.foo
2558+
import bar
2559+
[file bar.py]
2560+
def foo() -> int: ...
2561+
if foo: ... # E: Function "foo" could always be true in boolean context
2562+
42 + "no" # type: ignore
2563+
[file tests/__init__.py]
2564+
[file tests/foo.py]
2565+
def foo() -> int: ...
2566+
if foo: ... # E: Function "foo" could always be true in boolean context
2567+
42 + "no" # type: ignore # E: "type: ignore" comment without error code (consider "type: ignore[operator]" instead)
2568+
[file mypy.ini]
2569+
\[mypy]
2570+
disable_error_code = ignore-without-code
2571+
2572+
\[mypy-tests.*]
2573+
enable_all_error_codes = True
2574+
2575+
25532576
[case testSpotCheckEnableAllErrorCodesCountermand]
25542577
# flags: --enable-all-error-codes --disable-error-code unused-ignore
25552578
x = 2 # type: ignore # E: "type: ignore" comment without error code

0 commit comments

Comments
 (0)