Skip to content

MAINT: Fix tests #12928

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,7 @@ jobs:
pytest:
name: '${{ matrix.os }} / ${{ matrix.kind }} / ${{ matrix.python }}'
needs: style
timeout-minutes: 70
continue-on-error: true
timeout-minutes: 80
runs-on: ${{ matrix.os }}
defaults:
run:
Expand All @@ -54,6 +53,7 @@ jobs:
MNE_CI_KIND: '${{ matrix.kind }}'
CI_OS_NAME: '${{ matrix.os }}'
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
Expand Down Expand Up @@ -132,4 +132,4 @@ jobs:
- uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
if: always()
if: success() || failure()
2 changes: 2 additions & 0 deletions doc/sphinxext/mne_doc_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@ def reset_warnings(gallery_conf, fname):
r"numpy\.core is deprecated and has been renamed to numpy\._core",
# matplotlib
"__array_wrap__ must accept context and return_scalar.*",
# selenium
"setting remote_server_addr",
):
warnings.filterwarnings( # deal with other modules having bad imports
"ignore", message=f".*{key}.*", category=DeprecationWarning
Expand Down
1 change: 1 addition & 0 deletions mne/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ def pytest_configure(config):
ignore:Passing a schema to Validator\.iter_errors is deprecated.*:
ignore:Unclosed context <zmq.asyncio.Context.*:ResourceWarning
ignore:Jupyter is migrating its paths.*:DeprecationWarning
ignore:datetime\.datetime\.utcnow\(\) is deprecated.*:DeprecationWarning
ignore:Widget\..* is deprecated\.:DeprecationWarning
ignore:.*is deprecated in pyzmq.*:DeprecationWarning
ignore:The `ipykernel.comm.Comm` class has been deprecated.*:DeprecationWarning
Expand Down
2 changes: 1 addition & 1 deletion mne/decoding/receptive_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def _check_dimensions(self, X, y, predict=False):
f"X and y do not have the same n_epochs\n{X.shape[1]} != "
f"{y.shape[1]}"
)
if predict and y.shape[-1] != len(self.estimator_.coef_):
if predict and y.shape[-1] not in (len(self.estimator_.coef_), 1):
raise ValueError(
"Number of outputs does not match estimator coefficients dimensions"
)
Expand Down
1 change: 1 addition & 0 deletions mne/decoding/tests/test_receptive_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ def test_receptive_field_basic(n_jobs):
feature_names = [f"feature_{ii}" for ii in [0, 1, 2]]
rf = ReceptiveField(tmin, tmax, 1, feature_names, estimator=mod, patterns=True)
rf.fit(X, y)
assert rf.coef_.shape == (3, 11)
assert_array_equal(rf.delays_, np.arange(tmin, tmax + 1))

y_pred = rf.predict(X)
Expand Down
5 changes: 3 additions & 2 deletions mne/stats/regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,9 +297,10 @@ def solver(X, y):
coefs = solver(X, data.T)
if coefs.shape[0] != data.shape[0]:
raise ValueError(
"solver output has unexcepted shape. Supply a "
f"solver output has unexcepted shape {coefs.shape}. Supply a "
"function that returns coefficients in the form "
"(n_targets, n_features), where targets == channels."
"(n_targets, n_features), where "
f"n_targets == n_channels == {data.shape[0]}."
)

# construct Evoked objects to be returned from output
Expand Down
4 changes: 3 additions & 1 deletion mne/stats/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,9 @@ def test_continuous_regression_with_overlap():
from sklearn.linear_model import ridge_regression

def solver(X, y):
return ridge_regression(X, y, alpha=0.0, solver="cholesky")
# Newer scikit-learn returns 1D array for ridge_regression, so ensure
# 2D output
return np.atleast_2d(ridge_regression(X, y, alpha=0.0, solver="cholesky"))

assert_allclose(
effect,
Expand Down
Loading