8000 Add test_pyproject_toml · realpython/pytest-mypy@534dc92 · GitHub
[go: up one dir, main page]

Skip to content

Commit 534dc92

Browse files
committed
Add test_pyproject_toml
1 parent cf649b9 commit 534dc92

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

tests/test_pytest_mypy.py

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

350350

351+
def test_pyproject_toml(testdir, xdist_args):
352+
"""Ensure that the plugin allows configuration with pyproject.toml."""
353+
testdir.makefile(
354+
".toml",
355+
pyproject="""
356+
[tool.mypy]
357+
disallow_untyped_defs = true
358+
""",
359+
)
360+
testdir.makepyfile(
361+
conftest="""
362+
def pyfunc(x):
363+
return x * 2
364+
""",
365+
)
366+
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
367+
result.stdout.fnmatch_lines(["1: error: Function is missing a type annotation*"])
368+
assert result.ret != 0
369+
370+
351371
def test_setup_cfg(testdir, xdist_args):
352372
"""Ensure that the plugin allows configuration with setup.cfg."""
353373
testdir.makefile(

0 commit comments

Comments
 (0)
0