diff --git a/pyproject.toml b/pyproject.toml index 22e28f8f6f68..0b14dd419d08 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -79,3 +79,47 @@ extra-standard-library = ["typing_extensions"] [tool.check-manifest] ignore = ["**/.readthedocs.yaml"] + +[tool.pytest.ini_options] +minversion = "6.0.0" +testpaths = ["mypy/test", "mypyc/test"] +python_files = 'test*.py' + +# Where do the test cases come from? We provide our own collection +# logic by implementing `pytest_pycollect_makeitem` in mypy.test.data; +# the test files import that module, and pytest sees the magic name +# and invokes it at the relevant moment. See +# https://doc.pytest.org/en/latest/how-to/writing_plugins.html#collection-hooks + +# Both our plugin and unittest provide their own collection logic, +# So we can disable the default python collector by giving it empty +# patterns to search for. +# Note that unittest requires that no "Test*" classes exist. +python_classes = [] +python_functions = [] + +# always run in parallel (requires pytest-xdist, see test-requirements.txt) +# and enable strict mode: require all markers +# to be defined and raise on invalid config values +addopts = "-nauto --strict-markers --strict-config" + +# treat xpasses as test failures so they get converted to regular tests as soon as possible +xfail_strict = true + +[tool.coverage.run] +branch = true +source = "mypy" +parallel = true + +[tool.coverage.report] +show_missing = true +skip_covered = true +omit = 'mypy/test/*' +exclude_lines = [ + '\#\s*pragma: no cover', + '^\s*raise AssertionError\b', + '^\s*raise NotImplementedError\b', + '^\s*return NotImplemented\b', + '^\s*raise$', + '''^if __name__ == ['"]__main__['"]:$''', +] diff --git a/pytest.ini b/pytest.ini deleted file mode 100644 index a123b0f11328..000000000000 --- a/pytest.ini +++ /dev/null @@ -1,27 +0,0 @@ -[pytest] -minversion = 6.0.0 - -testpaths = mypy/test mypyc/test - -python_files = test*.py - -# Where do the test cases come from? We provide our own collection -# logic by implementing `pytest_pycollect_makeitem` in mypy.test.data; -# the test files import that module, and pytest sees the magic name -# and invokes it at the relevant moment. See -# https://doc.pytest.org/en/latest/how-to/writing_plugins.html#collection-hooks - -# Both our plugin and unittest provide their own collection logic, -# So we can disable the default python collector by giving it empty -# patterns to search for. -# Note that unittest requires that no "Test*" classes exist. -python_classes = -python_functions = - -# always run in parallel (requires pytest-xdist, see test-requirements.txt) -# and enable strict mode: require all markers -# to be defined and raise on invalid config values -addopts = -nauto --strict-markers --strict-config - -# treat xpasses as test failures so they get converted to regular tests as soon as possible -xfail_strict = true diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index 04d75ac8d19f..000000000000 --- a/setup.cfg +++ /dev/null @@ -1,16 +0,0 @@ -[coverage:run] -branch = true -source = mypy -parallel = true - -[coverage:report] -show_missing = true -skip_covered = True -omit = mypy/test/* -exclude_lines = - \#\s*pragma: no cover - ^\s*raise AssertionError\b - ^\s*raise NotImplementedError\b - ^\s*return NotImplemented\b - ^\s*raise$ - ^if __name__ == ['"]__main__['"]:$