Skip to content

Commit b09d170

Browse files
authored
Add a config for pytest (#680)
1 parent fba75a1 commit b09d170

File tree

3 files changed

+89
-1
lines changed

3 files changed

+89
-1
lines changed

pytest.ini

+87
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
[pytest]
2+
addopts =
3+
# FIXME: Enable this once the test suite has no race conditions
4+
# `pytest-xdist`:
5+
# --numprocesses=auto
6+
7+
# Show 10 slowest invocations:
8+
--durations=10
9+
10+
# A bit of verbosity doesn't hurt:
11+
-v
12+
13+
# Report all the things == -rxXs:
14+
-ra
15+
16+
# Show values of the local vars in errors/tracebacks:
17+
--showlocals
18+
19+
# Autocollect and invoke the doctests from all modules:
20+
# https://docs.pytest.org/en/stable/doctest.html
21+
--doctest-modules
22+
23+
# Dump the test results in junit format:
24+
--junitxml=.tox/tmp/test-results/pytest/results.xml
25+
26+
# Fail on config parsing warnings:
27+
--strict-config
28+
29+
# Fail on non-existing markers:
30+
# * Deprecated since v6.2.0 but may be reintroduced later covering a
31+
# broader scope:
32+
# --strict
33+
# * Exists since v4.5.0 (advised to be used instead of `--strict`):
34+
--strict-markers
35+
36+
# `pytest-cov`:
37+
# `pytest-cov`, "-p" preloads the module early:
38+
-p pytest_cov
39+
--no-cov-on-fail
40+
--cov=proxy
41+
--cov=tests/
42+
--cov-branch
43+
--cov-report=term-missing:skip-covered
44+
--cov-report=html:.tox/tmp/test-results/pytest/cov/
45+
--cov-report=xml
46+
--cov-context=test
47+
--cov-config=.coveragerc
48+
49+
doctest_optionflags = ALLOW_UNICODE ELLIPSIS
50+
51+
# Marks tests with an empty parameterset as xfail(run=False)
52+
empty_parameter_set_mark = xfail
53+
54+
faulthandler_timeout = 30
55+
56+
filterwarnings =
57+
error
58+
59+
junit_duration_report = call
60+
# xunit1 contains more metadata than xunit2 so it's better for CI UIs:
61+
junit_family = xunit1
62+
junit_logging = all
63+
junit_log_passing_tests = true
64+
junit_suite_name = proxy_py_test_suite
65+
66+
# A mapping of markers to their descriptions allowed in strict mode:
67+
markers =
68+
69+
minversion = 6.2.0
70+
71+
# Optimize pytest's lookup by restricting potentially deep dir tree scan:
72+
norecursedirs =
73+
build
74+
dist
75+
docs
76+
examples
77+
proxy.egg-info
78+
.cache
79+
.eggs
80+
.git
81+
.github
82+
.tox
83+
*.egg
84+
85+
testpaths = tests/
86+
87+
xfail_strict = true

requirements-testing.txt

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ coverage==6.1.1
44
flake8==4.0.1
55
pytest==6.2.5
66
pytest-cov==3.0.0
7+
pytest-xdist == 2.4.0
78
autopep8==1.6.0
89
mypy==0.910
910
py-spy==0.3.10

tox.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ deps =
1111
# NOTE: `{envpython} -m pytest` because it'd add CWD into $PYTHONPATH
1212
# NOTE: testing the project from the Git checkout
1313
# NOTE: rather than one installed.
14-
commands = pytest --cov=proxy --cov=tests/ --cov-report=xml tests/ {posargs:}
14+
commands = pytest {posargs:}
1515

1616

1717
[dists]

0 commit comments

Comments
 (0)