Skip to content

Commit

Permalink
Consolidate config in pyproject.toml (#15548)
Browse files Browse the repository at this point in the history
There's no real need for us to have separate `setup.cfg` and
`pytest.ini` files these days
  • Loading branch information
AlexWaygood authored Jun 29, 2023
1 parent 66d03da commit 06282b5
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 43 deletions.
44 changes: 44 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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__['"]:$''',
]
27 changes: 0 additions & 27 deletions pytest.ini

This file was deleted.

16 changes: 0 additions & 16 deletions setup.cfg

This file was deleted.

0 comments on commit 06282b5

Please sign in to comment.