From 4b46e9565ea64ffb26c03783206f7ac73d153a84 Mon Sep 17 00:00:00 2001 From: David Tucker Date: Sat, 6 May 2023 13:06:42 -0700 Subject: [PATCH] Add test_pyproject_toml --- tests/test_pytest_mypy.py | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/tests/test_pytest_mypy.py b/tests/test_pytest_mypy.py index 0f10dc5..29a406d 100644 --- a/tests/test_pytest_mypy.py +++ b/tests/test_pytest_mypy.py @@ -348,6 +348,30 @@ def pytest_configure(config): assert result.ret != 0 +@pytest.mark.xfail( + Version("0.900") > MYPY_VERSION, + reason="Mypy added pyproject.toml configuration in 0.900.", +) +def test_pyproject_toml(testdir, xdist_args): + """Ensure that the plugin allows configuration with pyproject.toml.""" + testdir.makefile( + ".toml", + pyproject=""" + [tool.mypy] + disallow_untyped_defs = true + """, + ) + testdir.makepyfile( + conftest=""" + def pyfunc(x): + return x * 2 + """, + ) + result = testdir.runpytest_subprocess("--mypy", *xdist_args) + result.stdout.fnmatch_lines(["1: error: Function is missing a type annotation*"]) + assert result.ret != 0 + + def test_setup_cfg(testdir, xdist_args): """Ensure that the plugin allows configuration with setup.cfg.""" testdir.makefile(