Skip to content

Commit 5bc0a8f

Browse files
authored
MAINT: Move conftest (mne-tools#6309)
1 parent 9db91c1 commit 5bc0a8f

File tree

3 files changed

+55
-39
lines changed

3 files changed

+55
-39
lines changed

MANIFEST.in

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ include LICENSE.txt
33
include requirements.txt
44
include mne/__init__.py
55

6-
include conftest.py
76
recursive-include examples *.py
87
recursive-include examples *.txt
98
recursive-include tutorials *.py

conftest.py renamed to mne/conftest.py

+55
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,58 @@
3131
fname_fwd = op.join(s_path, 'sample_audvis_trunc-meg-eeg-oct-4-fwd.fif')
3232

3333

34+
def pytest_configure(config):
35+
"""Configure pytest options."""
36+
# Set the timeout pretty low to ensure we do not by default add really long
37+
# tests, or make changes that make things a lot slower
38+
config.addinivalue_line(
39+
'addopts',
40+
'--showlocals --durations=20 --doctest-modules -ra --cov-report= '
41+
'--doctest-ignore-import-errors --junit-xml=junit-results.xml '
42+
'--ignore=doc --ignore=logo --ignore=examples --ignore=tutorials '
43+
'--ignore=mne/gui/_*.py --timeout 30')
44+
45+
# Markers
46+
for marker in ('slowtest', 'ultraslowtest'):
47+
config.addinivalue_line('markers', marker)
48+
49+
# Fixtures
50+
for fixture in ('matplotlib_config',):
51+
config.addinivalue_line('usefixtures', fixture)
52+
53+
# Warnings
54+
# - Once SciPy updates not to have non-integer and non-tuple errors (1.2.0)
55+
# we should remove them from here.
56+
# - This list should also be considered alongside reset_warnings in
57+
# doc/conf.py.
58+
warning_lines = """
59+
error::
60+
ignore::ImportWarning
61+
ignore:the matrix subclass:PendingDeprecationWarning
62+
ignore:numpy.dtype size changed:RuntimeWarning
63+
ignore:.*HasTraits.trait_.*:DeprecationWarning
64+
ignore:.*takes no parameters:DeprecationWarning
65+
ignore:joblib not installed:RuntimeWarning
66+
ignore:Using a non-tuple sequence for multidimensional indexing:FutureWarning
67+
ignore:using a non-integer number instead of an integer will result in an error:DeprecationWarning
68+
ignore:Importing from numpy.testing.decorators is deprecated:DeprecationWarning
69+
ignore:np.loads is deprecated, use pickle.loads instead:DeprecationWarning
70+
ignore:The oldnumeric module will be dropped:DeprecationWarning
71+
ignore:Collection picker None could not be converted to float:UserWarning
72+
ignore:covariance is not positive-semidefinite:RuntimeWarning
73+
ignore:Can only plot ICA components:RuntimeWarning
74+
ignore:Matplotlib is building the font cache using fc-list:UserWarning
75+
ignore:Using or importing the ABCs from 'collections':DeprecationWarning
76+
ignore:`formatargspec` is deprecated:DeprecationWarning
77+
# This is only necessary until sklearn updates their wheels for NumPy 1.16
78+
ignore:numpy.ufunc size changed:RuntimeWarning
79+
""" # noqa: E501
80+
for warning_line in warning_lines.split('\n'):
81+
warning_line = warning_line.strip()
82+
if warning_line and not warning_line.startswith('#'):
83+
config.addinivalue_line('filterwarnings', warning_line)
84+
85+
3486
@pytest.fixture(scope='session')
3587
def matplotlib_config():
3688
"""Configure matplotlib for viz tests."""
@@ -73,6 +125,7 @@ def evoked():
73125

74126
@pytest.fixture(scope='function', params=[testing._pytest_param()])
75127
def noise_cov():
128+
"""Get a noise cov from the testing dataset."""
76129
return mne.read_cov(fname_cov)
77130

78131

@@ -115,11 +168,13 @@ def _bias_params(evoked, noise_cov, fwd):
115168
"pyvista",
116169
])
117170
def backend_name(request):
171+
"""Get the backend name."""
118172
yield request.param
119173

120174

121175
@pytest.yield_fixture
122176
def backends_3d(backend_name):
177+
"""Yield the 3D backends."""
123178
from mne.viz.backends.renderer import _use_test_3d_backend
124179
from mne.viz.backends.tests._utils import has_mayavi, has_pyvista
125180
if backend_name == 'mayavi':

setup.cfg

-38
Original file line numberDiff line numberDiff line change
@@ -14,44 +14,6 @@ release = egg_info -RDb ''
1414
[bdist_rpm]
1515
doc-files = doc
1616

17-
[tool:pytest]
18-
addopts = --showlocals --durations=20 --doctest-modules -ra --cov-report=
19-
--doctest-ignore-import-errors --junit-xml=junit-results.xml
20-
--ignore=doc --ignore=logo --ignore=examples --ignore=tutorials
21-
--ignore=mne/gui/_*.py
22-
markers =
23-
slowtest
24-
ultraslowtest
25-
usefixtures = matplotlib_config
26-
# Set this pretty low to ensure we do not by default add really long tests,
27-
# or make changes that make things a lot slower
28-
timeout = 30
29-
# Once SciPy updates not to have non-integer and non-tuple errors (1.2.0) we
30-
# should remove them from here.
31-
# This list should also be considered alongside reset_warnings in doc/conf.py
32-
filterwarnings =
33-
error::
34-
ignore::ImportWarning
35-
ignore:the matrix subclass:PendingDeprecationWarning
36-
ignore:numpy.dtype size changed:RuntimeWarning
37-
ignore:.*HasTraits.trait_.*:DeprecationWarning
38-
ignore:.*takes no parameters:DeprecationWarning
39-
ignore:joblib not installed:RuntimeWarning
40-
ignore:Using a non-tuple sequence for multidimensional indexing:FutureWarning
41-
ignore:using a non-integer number instead of an integer will result in an error:DeprecationWarning
42-
ignore:Importing from numpy.testing.decorators is deprecated:DeprecationWarning
43-
ignore:np.loads is deprecated, use pickle.loads instead:DeprecationWarning
44-
ignore:The oldnumeric module will be dropped:DeprecationWarning
45-
ignore:Collection picker None could not be converted to float:UserWarning
46-
ignore:covariance is not positive-semidefinite:RuntimeWarning
47-
ignore:Can only plot ICA components:RuntimeWarning
48-
ignore:Matplotlib is building the font cache using fc-list:UserWarning
49-
ignore:Using or importing the ABCs from 'collections':DeprecationWarning
50-
ignore:`formatargspec` is deprecated:DeprecationWarning
51-
# This is only necessary until sklearn updates their wheels for NumPy 1.16
52-
ignore:numpy.ufunc size changed:RuntimeWarning
53-
54-
5517
[flake8]
5618
exclude = __init__.py,*externals*,constants.py,fixes.py
5719
ignore = E241,E305,W504

0 commit comments

Comments
 (0)