|
31 | 31 | fname_fwd = op.join(s_path, 'sample_audvis_trunc-meg-eeg-oct-4-fwd.fif')
|
32 | 32 |
|
33 | 33 |
|
| 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 | + |
34 | 86 | @pytest.fixture(scope='session')
|
35 | 87 | def matplotlib_config():
|
36 | 88 | """Configure matplotlib for viz tests."""
|
@@ -73,6 +125,7 @@ def evoked():
|
73 | 125 |
|
74 | 126 | @pytest.fixture(scope='function', params=[testing._pytest_param()])
|
75 | 127 | def noise_cov():
|
| 128 | + """Get a noise cov from the testing dataset.""" |
76 | 129 | return mne.read_cov(fname_cov)
|
77 | 130 |
|
78 | 131 |
|
@@ -115,11 +168,13 @@ def _bias_params(evoked, noise_cov, fwd):
|
115 | 168 | "pyvista",
|
116 | 169 | ])
|
117 | 170 | def backend_name(request):
|
| 171 | + """Get the backend name.""" |
118 | 172 | yield request.param
|
119 | 173 |
|
120 | 174 |
|
121 | 175 | @pytest.yield_fixture
|
122 | 176 | def backends_3d(backend_name):
|
| 177 | + """Yield the 3D backends.""" |
123 | 178 | from mne.viz.backends.renderer import _use_test_3d_backend
|
124 | 179 | from mne.viz.backends.tests._utils import has_mayavi, has_pyvista
|
125 | 180 | if backend_name == 'mayavi':
|
|
0 commit comments