Skip to content

Commit 5fed2b6

Browse files
authored
ENH: Cleaner forward solution plotting options (#13313)
1 parent 715784f commit 5fed2b6

File tree

11 files changed

+194
-177
lines changed

11 files changed

+194
-177
lines changed

azure-pipelines.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,15 +198,15 @@ stages:
198198
set -eo pipefail
199199
mne sys_info -pd
200200
mne sys_info -pd | grep "qtpy .* (PyQt6=.*)$"
201-
PYTEST_QT_API=PyQt6 pytest ${TEST_OPTIONS}
201+
PYTEST_QT_API=PyQt6 pytest -m "not ultraslowtest" ${TEST_OPTIONS}
202202
python -m pip uninstall -yq PyQt6 PyQt6-sip PyQt6-Qt6
203203
displayName: 'PyQt6'
204204
- bash: |
205205
set -eo pipefail
206206
python -m pip install "PySide6!=6.8.0,!=6.8.0.1,!=6.9.1"
207207
mne sys_info -pd
208208
mne sys_info -pd | grep "qtpy .* (PySide6=.*)$"
209-
PYTEST_QT_API=PySide6 pytest ${TEST_OPTIONS}
209+
PYTEST_QT_API=PySide6 pytest -m "not ultraslowtest" ${TEST_OPTIONS}
210210
python -m pip uninstall -yq PySide6
211211
displayName: 'PySide6'
212212
# PyQt5 leaves cruft behind, so run it last
@@ -215,7 +215,7 @@ stages:
215215
python -m pip install PyQt5
216216
mne sys_info -pd
217217
mne sys_info -pd | grep "qtpy .* (PyQt5=.*)$"
218-
PYTEST_QT_API=PyQt5 pytest ${TEST_OPTIONS}
218+
PYTEST_QT_API=PyQt5 pytest -m "not ultraslowtest" ${TEST_OPTIONS}
219219
python -m pip uninstall -yq PyQt5 PyQt5-sip PyQt5-Qt5
220220
displayName: 'PyQt5'
221221
# Coverage

mne/_fiff/tests/test_constants.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import numpy as np
1111
import pooch
1212
import pytest
13+
from flaky import flaky
1314

1415
from mne._fiff.constants import (
1516
FIFF,
@@ -117,7 +118,9 @@
117118
)
118119

119120

121+
@flaky
120122
@requires_good_network
123+
@pytest.mark.ultraslowtest # not that slow, just doesn't need to run very often
121124
def test_constants(tmp_path):
122125
"""Test compensation."""
123126
fname = "fiff.zip"

mne/bem.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1019,7 +1019,7 @@ def get_fitting_dig(info, dig_kinds="auto", exclude_frontal=True, verbose=None):
10191019
.. versionadded:: 0.14
10201020
"""
10211021
_validate_type(info, "info")
1022-
if info["dig"] is None:
1022+
if info.get("dig", None) is None: # "dig" can be missing for fwd/inv
10231023
raise RuntimeError(
10241024
'Cannot fit headshape without digitization, info["dig"] is None'
10251025
)

mne/conftest.py

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,12 +84,13 @@
8484
def pytest_configure(config: pytest.Config):
8585
"""Configure pytest options."""
8686
# Markers
87+
# can be queried with `pytest --markers` for example
8788
for marker in (
88-
"slowtest",
89-
"ultraslowtest",
90-
"pgtest",
91-
"pvtest",
92-
"allow_unclosed",
89+
"slowtest: mark a test as slow",
90+
"ultraslowtest: mark a test as ultraslow or to be run rarely",
91+
"pgtest: mark a test as relevant for mne-qt-browser",
92+
"pvtest: mark a test as relevant for pyvistaqt",
93+
"allow_unclosed: allow unclosed pyvistaqt instances",
9394
):
9495
config.addinivalue_line("markers", marker)
9596

@@ -203,6 +204,13 @@ def pytest_configure(config: pytest.Config):
203204
config.addinivalue_line("filterwarnings", warning_line)
204205

205206

207+
def pytest_collection_modifyitems(items: list[pytest.Item]):
208+
"""Add slowtest marker automatically to anything marked ultraslow."""
209+
for item in items:
210+
if len(list(item.iter_markers("ultraslowtest"))):
211+
item.add_marker(pytest.mark.slowtest)
212+
213+
206214
# Have to be careful with autouse=True, but this is just an int comparison
207215
# so it shouldn't really add appreciable overhead
208216
@pytest.fixture(autouse=True)
@@ -1197,7 +1205,8 @@ def pytest_runtest_makereport(item, call):
11971205
outcome = yield
11981206
rep: pytest.TestReport = outcome.get_result()
11991207
item.stash.setdefault(_phase_report_key, {})[rep.when] = rep
1200-
_modify_report_skips(rep)
1208+
if rep.outcome == "passed": # only check for skips etc. if otherwise green
1209+
_modify_report_skips(rep)
12011210
return rep
12021211

12031212

mne/datasets/tests/test_datasets.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def _error_download_2(self, fname, downloader, processor):
175175

176176

177177
@flaky(max_runs=3)
178-
@pytest.mark.slowtest
178+
@pytest.mark.ultraslowtest # not really ultraslow, but flakes out a lot
179179
@testing.requires_testing_data
180180
@requires_good_network
181181
def test_fetch_parcellations(tmp_path):

mne/html_templates/report/forward.html.jinja

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,5 @@
22
{% block html_content %}
33
{{repr | safe}}
44
{{sensitivity_maps | safe}}
5+
{{source_space | safe}}
56
{% endblock html_content %}

mne/html_templates/report/image.html.jinja

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
{% if not embedded %}
12
{% extends "section.html.jinja" %}
3+
{% endif %}
24
{% block html_content %}
35
<figure class="figure mx-auto d-block">
46
{% if image_format == 'svg' %}

mne/preprocessing/tests/test_fine_cal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def test_compute_fine_cal(kind):
8888
angle_limit = 10
8989
cl["grad"] = (0.0, 0.1)
9090
gwoma = [48, 52]
91-
ggoma = [13, 67]
92-
ggwma = [13, 120]
91+
ggoma = [13, 82]
92+
ggwma = [13, 135]
9393
sfs = [34, 35, 27, 28, 50, 53, 75, 79] # ours is better!
9494
cl3 = [-0.3, -0.1]
9595
raw = read_raw_fif(erm)

0 commit comments

Comments
 (0)