Skip to content

Commit 4b46e95

Browse files
committed
Add test_pyproject_toml
1 parent cf649b9 commit 4b46e95

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

tests/test_pytest_mypy.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -348,6 +348,30 @@ def pytest_configure(config):
348348
assert result.ret != 0
349349

350350

351+
@pytest.mark.xfail(
352+
Version("0.900") > MYPY_VERSION,
353+
reason="Mypy added pyproject.toml configuration in 0.900.",
354+
)
355+
def test_pyproject_toml(testdir, xdist_args):
356+
"""Ensure that the plugin allows configuration with pyproject.toml."""
357+
testdir.makefile(
358+
".toml",
359+
pyproject="""
360+
[tool.mypy]
361+
disallow_untyped_defs = true
362+
""",
363+
)
364+
testdir.makepyfile(
365+
conftest="""
366+
def pyfunc(x):
367+
return x * 2
368+
""",
369+
)
370+
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
371+
result.stdout.fnmatch_lines(["1: error: Function is missing a type annotation*"])
372+
assert result.ret != 0
373+
374+
351375
def test_setup_cfg(testdir, xdist_args):
352376
"""Ensure that the plugin allows configuration with setup.cfg."""
353377
testdir.makefile(

0 commit comments

Comments
 (0)