Skip to content

Commit 4740b5b

Browse files
authored
Merge pull request #154 from dmtucker/toml-config
Add test_pyproject_toml
2 parents 62c03db + 4b46e95 commit 4740b5b

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
@@ -375,6 +375,30 @@ def pytest_configure(config):
375375
assert result.ret != 0
376376

377377

378+
@pytest.mark.xfail(
379+
Version("0.900") > MYPY_VERSION,
380+
reason="Mypy added pyproject.toml configuration in 0.900.",
381+
)
382+
def test_pyproject_toml(testdir, xdist_args):
383+
"""Ensure that the plugin allows configuration with pyproject.toml."""
384+
testdir.makefile(
385+
".toml",
386+
pyproject="""
387+
[tool.mypy]
388+
disallow_untyped_defs = true
389+
""",
390+
)
391+
testdir.makepyfile(
392+
conftest="""
393+
def pyfunc(x):
394+
return x * 2
395+
""",
396+
)
397+
result = testdir.runpytest_subprocess("--mypy", *xdist_args)
398+
result.stdout.fnmatch_lines(["1: error: Function is missing a type annotation*"])
399+
assert result.ret != 0
400+
401+
378402
def test_setup_cfg(testdir, xdist_args):
379403
"""Ensure that the plugin allows configuration with setup.cfg."""
380404
testdir.makefile(

0 commit comments

Comments
 (0)