Skip to content

Fix all 216 pytest warnings across the test suite#995

Merged
bruAristimunha merged 12 commits intodevelopfrom
fix/resolve-test-warnings
Feb 28, 2026
Merged

Fix all 216 pytest warnings across the test suite#995
bruAristimunha merged 12 commits intodevelopfrom
fix/resolve-test-warnings

Conversation

@bruAristimunha
Copy link
Collaborator

Summary

  • Resolves all 216 warnings emitted during pytest moabb/tests -W all, bringing the count to 0 warnings
  • All 1060 tests continue to pass
  • Each warning category is addressed at its root cause rather than globally suppressed

Warning fixes by category

File Warning Count Fix
moabb/paradigms/base.py Annotations lost during concatenate_epochs ~86 Clear annotations before concatenation (MOABB doesn't use them post-concat)
moabb/datasets/fake.py MNE non-standard config key ~60 Targeted suppression — MOABB intentionally extends MNE config
moabb/tests/test_evaluations.py Lambda function hash warning 42 Replace lambda x: x with named _identity function
moabb/evaluations/utils.py OptunaSearchCV ExperimentalWarning ~10 Patch __init__ with functools.wraps to suppress upstream warning
moabb/datasets/bids_interface.py EDF conversion + double format 6 Suppress at write_raw_bids call (format explicitly requested)
moabb/evaluations/splitters.py TimeSeriesSplit ignores groups 6 Suppress at split() call — sklearn accepts groups everywhere but warns
moabb/tests/test_classification.py pyriemann numerical issues 2 @pytest.mark.filterwarnings on SSVEP_TRCA tests
moabb/datasets/preprocessing.py Unknown channel location 1 Suppress at call + re-apply montage after add_reference_channels

Test plan

  • pytest moabb/tests -W all — 1060 passed, 0 warnings
  • test_lambda_warning still verifies the intentional warning works
  • test_eval_grid_search_optuna passes (sklearn clone compatibility preserved)
  • test_custom_inner_cv passes with TimeSeriesSplit
  • test_BaseImagery_cache passes (no dtype regression)

bruAristimunha and others added 2 commits February 27, 2026 14:14
Address root causes of warnings emitted during test runs:

- Clear Epochs annotations before concatenation in paradigm processing
- Replace lambda with named function in test pipelines to avoid hash warning
- Suppress MNE non-standard config warning in FakeDataset (intentional usage)
- Suppress OptunaSearchCV ExperimentalWarning at init via functools.wraps patch
- Suppress mne_bids format conversion warnings during BIDS write
- Re-apply montage after add_reference_channels for proper channel locations
- Handle sklearn TimeSeriesSplit groups parameter warning in splitters
- Add filterwarnings markers for pyriemann numerical issues in SSVEP tests
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 29c77530db

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

bruAristimunha and others added 10 commits February 28, 2026 14:47
- fake.py: Use os.environ instead of mne.set_config to avoid
  non-standard config key warnings (~60 warnings)
- preprocessing.py: Remove montage before adding reference channels
  then re-apply, instead of suppressing location warnings
- splitters.py: Use GroupsConsumerMixin to detect group-aware
  cv_classes and conditionally pass groups parameter (~6 warnings).
  LearningCurveSplitter now inherits GroupsConsumerMixin since it
  genuinely uses groups.
…echX/moabb into fix/resolve-test-warnings

# Conflicts:
#	moabb/evaluations/splitters.py
…nce matrices

The cross-covariance blocks passed to pyriemann's mean_covariance were not
guaranteed to be well-conditioned SPD matrices, causing 'Convergence not
reached' and 'invalid value encountered in log' warnings.  Symmetrize each
matrix and clamp small eigenvalues to bound the condition number at 1e4
before computing the Riemannian/log-Euclidean mean.

Remove the corresponding filterwarnings suppressions from the test.
…ping

Replace manual eigenvalue decomposition and clamping with pyriemann's
Shrinkage estimator and trace normalization to regularize ill-conditioned
cross-covariance matrices before computing the Riemannian mean.
@bruAristimunha bruAristimunha merged commit b77c6b1 into develop Feb 28, 2026
14 checks passed
@bruAristimunha bruAristimunha deleted the fix/resolve-test-warnings branch March 2, 2026 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant