Skip to content

Commit 8de5139

Browse files
committed
Create test_mypy_config_file
1 parent 5fbff02 commit 8de5139

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

tests/test_pytest_mypy.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,34 @@ def test_mypy_ignore_missings_imports(testdir, xdist_args):
129129
assert result.ret == 0
130130

131131

132+
def test_mypy_config_file(testdir, xdist_args):
133+
"""Verify that --mypy-config-file works."""
134+
testdir.makepyfile(
135+
"""
136+
def pyfunc(x):
137+
return x * 2
138+
""",
139+
)
140+
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
141+
mypy_file_checks = 1
142+
mypy_status_check = 1
143+
mypy_checks = mypy_file_checks + mypy_status_check
144+
result.assert_outcomes(passed=mypy_checks)
145+
assert result.ret == 0
146+
mypy_config_file = testdir.makeini(
147+
"""
148+
[mypy]
149+
disallow_untyped_defs = True
150+
""",
151+
)
152+
result = testdir.runpytest_subprocess(
153+
"--mypy-config-file",
154+
mypy_config_file,
155+
*xdist_args,
156+
)
157+
result.assert_outcomes(failed=mypy_checks)
158+
159+
132160
def test_mypy_marker(testdir, xdist_args):
133161
"""Verify that -m mypy only runs the mypy tests."""
134162
testdir.makepyfile(

0 commit comments

Comments
 (0)