Skip to content

Commit d8927bd

Browse files
authored
Infra: Improve tests and coverage configuration (#4715)
1 parent 0b65b03 commit d8927bd

File tree

4 files changed

+45
-17
lines changed

4 files changed

+45
-17
lines changed

.pytest.toml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# https://docs.pytest.org/en/stable/reference/customize.html
2+
3+
[pytest]
4+
minversion = "9.0"
5+
6+
# https://docs.pytest.org/en/stable/reference/reference.html#command-line-flags
7+
addopts = [
8+
# Show extra summary information for all non-passing tests
9+
"-r a",
10+
# https://docs.pytest.org/en/stable/explanation/pythonpath.html#import-modes
11+
"--import-mode=importlib",
12+
# https://pytest-cov.readthedocs.io/en/latest/config.html#reference
13+
"--cov=check_peps",
14+
"--cov=pep_sphinx_extensions",
15+
"--cov-report=html",
16+
"--cov-report=xml",
17+
]
18+
19+
# Fail if pytest.mark.parametrize() has no parameters
20+
empty_parameter_set_mark = "fail_at_collect"
21+
22+
filterwarnings = ["error"]
23+
24+
testpaths = [
25+
"pep_sphinx_extensions",
26+
]
27+
28+
# https://docs.pytest.org/en/stable/reference/reference.html#confval-strict
29+
strict_config = true
30+
strict_markers = true
31+
strict_parametrization_ids = true
32+
strict_xfail = true
33+
34+
# Various tests use Unicode in pytest.mark.parametrize().
35+
disable_test_id_escaping_and_forfeit_all_rights_to_community_support = true

pytest.ini

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

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ docutils >= 0.19.0
77
sphinx-notfound-page >= 1.0.2
88

99
# For tests
10-
pytest
10+
pytest>=9
1111
pytest-cov
1212

1313
# For python-releases.toml

tox.ini

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,12 @@ pass_env =
1212
FORCE_COLOR
1313
commands =
1414
python -bb -X dev -W error -m pytest {posargs}
15+
16+
[coverage:run]
17+
omit =
18+
*/__main__.py # Ignore all __main__.py files
19+
peps/* # Ignore all files in the PEPs folder
20+
21+
[coverage:report]
22+
exclude_also =
23+
if __name__ == .__main__.:

0 commit comments

Comments
 (0)