Skip to content

Commit 06282b5

Browse files
authored
Consolidate config in pyproject.toml (#15548)
There's no real need for us to have separate `setup.cfg` and `pytest.ini` files these days
1 parent 66d03da commit 06282b5

File tree

3 files changed

+44
-43
lines changed

3 files changed

+44
-43
lines changed

pyproject.toml

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,47 @@ extra-standard-library = ["typing_extensions"]
7979

8080
[tool.check-manifest]
8181
ignore = ["**/.readthedocs.yaml"]
82+
83+
[tool.pytest.ini_options]
84+
minversion = "6.0.0"
85+
testpaths = ["mypy/test", "mypyc/test"]
86+
python_files = 'test*.py'
87+
88+
# Where do the test cases come from? We provide our own collection
89+
# logic by implementing `pytest_pycollect_makeitem` in mypy.test.data;
90+
# the test files import that module, and pytest sees the magic name
91+
# and invokes it at the relevant moment. See
92+
# https://doc.pytest.org/en/latest/how-to/writing_plugins.html#collection-hooks
93+
94+
# Both our plugin and unittest provide their own collection logic,
95+
# So we can disable the default python collector by giving it empty
96+
# patterns to search for.
97+
# Note that unittest requires that no "Test*" classes exist.
98+
python_classes = []
99+
python_functions = []
100+
101+
# always run in parallel (requires pytest-xdist, see test-requirements.txt)
102+
# and enable strict mode: require all markers
103+
# to be defined and raise on invalid config values
104+
addopts = "-nauto --strict-markers --strict-config"
105+
106+
# treat xpasses as test failures so they get converted to regular tests as soon as possible
107+
xfail_strict = true
108+
109+
[tool.coverage.run]
110+
branch = true
111+
source = "mypy"
112+
parallel = true
113+
114+
[tool.coverage.report]
115+
show_missing = true
116+
skip_covered = true
117+
omit = 'mypy/test/*'
118+
exclude_lines = [
119+
'\#\s*pragma: no cover',
120+
'^\s*raise AssertionError\b',
121+
'^\s*raise NotImplementedError\b',
122+
'^\s*return NotImplemented\b',
123+
'^\s*raise$',
124+
'''^if __name__ == ['"]__main__['"]:$''',
125+
]

pytest.ini

Lines changed: 0 additions & 27 deletions
This file was deleted.

setup.cfg

Lines changed: 0 additions & 16 deletions
This file was deleted.

0 commit comments

Comments
 (0)