Skip to content

Commit 74df09b

Browse files
committed
Use pyproject.toml for configuration in pytest itself
1 parent c7b1d7e commit 74df09b

File tree

2 files changed

+43
-42
lines changed

2 files changed

+43
-42
lines changed

pyproject.toml

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,49 @@ requires = [
77
]
88
build-backend = "setuptools.build_meta"
99

10+
[tool.pytest.ini_options]
11+
minversion = "2.0"
12+
addopts = "-rfEX -p pytester --strict-markers"
13+
python_files = ["test_*.py", "*_test.py", "testing/*/*.py"]
14+
python_classes = ["Test", "Acceptance"]
15+
python_functions = ["test"]
16+
# NOTE: "doc" is not included here, but gets tested explicitly via "doctesting".
17+
testpaths = ["testing"]
18+
norecursedirs = ["testing/example_scripts"]
19+
xfail_strict = true
20+
filterwarnings = [
21+
"error",
22+
"default:Using or importing the ABCs:DeprecationWarning:unittest2.*",
23+
"default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*",
24+
"ignore:Module already imported so cannot be rewritten:pytest.PytestWarning",
25+
# produced by python3.6/site.py itself (3.6.7 on Travis, could not trigger it with 3.6.8)."
26+
"ignore:.*U.*mode is deprecated:DeprecationWarning:(?!(pytest|_pytest))",
27+
# produced by pytest-xdist
28+
"ignore:.*type argument to addoption.*:DeprecationWarning",
29+
# produced by python >=3.5 on execnet (pytest-xdist)
30+
"ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning",
31+
# pytest's own futurewarnings
32+
"ignore::pytest.PytestExperimentalApiWarning",
33+
# Do not cause SyntaxError for invalid escape sequences in py37.
34+
# Those are caught/handled by pyupgrade, and not easy to filter with the
35+
# module being the filename (with .py removed).
36+
"default:invalid escape sequence:DeprecationWarning",
37+
# ignore use of unregistered marks, because we use many to test the implementation
38+
"ignore::_pytest.warning_types.PytestUnknownMarkWarning",
39+
]
40+
pytester_example_dir = "testing/example_scripts"
41+
markers = [
42+
# dummy markers for testing
43+
"foo",
44+
"bar",
45+
"baz",
46+
# conftest.py reorders tests moving slow ones to the end of the list
47+
"slow",
48+
# experimental mark for all tests using pexpect
49+
"uses_pexpect",
50+
]
51+
52+
1053
[tool.towncrier]
1154
package = "pytest"
1255
package_dir = "src"

tox.ini

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -152,48 +152,6 @@ deps =
152152
pypandoc
153153
commands = python scripts/publish-gh-release-notes.py {posargs}
154154

155-
156-
[pytest]
157-
minversion = 2.0
158-
addopts = -rfEX -p pytester --strict-markers
159-
rsyncdirs = tox.ini doc src testing
160-
python_files = test_*.py *_test.py testing/*/*.py
161-
python_classes = Test Acceptance
162-
python_functions = test
163-
# NOTE: "doc" is not included here, but gets tested explicitly via "doctesting".
164-
testpaths = testing
165-
norecursedirs = testing/example_scripts
166-
xfail_strict=true
167-
filterwarnings =
168-
error
169-
default:Using or importing the ABCs:DeprecationWarning:unittest2.*
170-
default:the imp module is deprecated in favour of importlib:DeprecationWarning:nose.*
171-
ignore:Module already imported so cannot be rewritten:pytest.PytestWarning
172-
# produced by python3.6/site.py itself (3.6.7 on Travis, could not trigger it with 3.6.8).
173-
ignore:.*U.*mode is deprecated:DeprecationWarning:(?!(pytest|_pytest))
174-
# produced by pytest-xdist
175-
ignore:.*type argument to addoption.*:DeprecationWarning
176-
# produced by python >=3.5 on execnet (pytest-xdist)
177-
ignore:.*inspect.getargspec.*deprecated, use inspect.signature.*:DeprecationWarning
178-
# pytest's own futurewarnings
179-
ignore::pytest.PytestExperimentalApiWarning
180-
# Do not cause SyntaxError for invalid escape sequences in py37.
181-
# Those are caught/handled by pyupgrade, and not easy to filter with the
182-
# module being the filename (with .py removed).
183-
default:invalid escape sequence:DeprecationWarning
184-
# ignore use of unregistered marks, because we use many to test the implementation
185-
ignore::_pytest.warning_types.PytestUnknownMarkWarning
186-
pytester_example_dir = testing/example_scripts
187-
markers =
188-
# dummy markers for testing
189-
foo
190-
bar
191-
baz
192-
# conftest.py reorders tests moving slow ones to the end of the list
193-
slow
194-
# experimental mark for all tests using pexpect
195-
uses_pexpect
196-
197155
[flake8]
198156
max-line-length = 120
199157
extend-ignore = E203

0 commit comments

Comments
 (0)