From 5605e5dfe7a8908e44b8de039dd97b710aac44b9 Mon Sep 17 00:00:00 2001 From: David Tucker Date: Sun, 9 Aug 2020 20:00:38 -0700 Subject: [PATCH] Add test_setup_cfg --- tests/test_pytest_mypy.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_pytest_mypy.py b/tests/test_pytest_mypy.py index 5abbfd2..45c211c 100644 --- a/tests/test_pytest_mypy.py +++ b/tests/test_pytest_mypy.py @@ -316,3 +316,20 @@ def pytest_configure(config): '*/bad.py:2: error: Incompatible return value*', ]) assert result.ret != 0 + + +def test_setup_cfg(testdir, xdist_args): + """Ensure that the plugin allows configuration with setup.cfg.""" + testdir.makefile('.cfg', setup=''' + [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