Skip to content

Commit e7ef34f

Browse files
Guilhem Saurelwjakob
Guilhem Saurel
authored andcommitted
1 parent 085a294 commit e7ef34f

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/conftest.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ def gc_collect():
185185
gc.collect()
186186

187187

188-
def pytest_namespace():
188+
def pytest_configure():
189189
"""Add import suppression and test requirements to `pytest` namespace"""
190190
try:
191191
import numpy as np
@@ -202,19 +202,17 @@ def pytest_namespace():
202202
pypy = platform.python_implementation() == "PyPy"
203203

204204
skipif = pytest.mark.skipif
205-
return {
206-
'suppress': suppress,
207-
'requires_numpy': skipif(not np, reason="numpy is not installed"),
208-
'requires_scipy': skipif(not np, reason="scipy is not installed"),
209-
'requires_eigen_and_numpy': skipif(not have_eigen or not np,
210-
reason="eigen and/or numpy are not installed"),
211-
'requires_eigen_and_scipy': skipif(not have_eigen or not scipy,
212-
reason="eigen and/or scipy are not installed"),
213-
'unsupported_on_pypy': skipif(pypy, reason="unsupported on PyPy"),
214-
'unsupported_on_py2': skipif(sys.version_info.major < 3,
215-
reason="unsupported on Python 2.x"),
216-
'gc_collect': gc_collect
217-
}
205+
pytest.suppress = suppress
206+
pytest.requires_numpy = skipif(not np, reason="numpy is not installed")
207+
pytest.requires_scipy = skipif(not np, reason="scipy is not installed")
208+
pytest.requires_eigen_and_numpy = skipif(not have_eigen or not np,
209+
reason="eigen and/or numpy are not installed")
210+
pytest.requires_eigen_and_scipy = skipif(
211+
not have_eigen or not scipy, reason="eigen and/or scipy are not installed")
212+
pytest.unsupported_on_pypy = skipif(pypy, reason="unsupported on PyPy")
213+
pytest.unsupported_on_py2 = skipif(sys.version_info.major < 3,
214+
reason="unsupported on Python 2.x")
215+
pytest.gc_collect = gc_collect
218216

219217

220218
def _test_import_pybind11():

0 commit comments

Comments
 (0)