Skip to content

Strengthen MNE conversion tests for EEG and ICA invariants #183

Closed

Description

@suraj-ranganath

🤖 Current MNE conversion tests mostly assert type and shape details, and one suite skips when EEGPREP_SKIP_MATLAB=1 even though it does not require MATLAB. This let the wrong EEG data orientation and invalid ICA field algebra survive.

Relevant code:

  • tests/test_eeg_mne2eeg_epochs.py:119 - shape-only ICA checks
  • tests/test_eeg_mne2eeg_epochs.py:257 - expected wrong data order
  • tests/test_eeg_eeg2mne.py:29 - MATLAB skip gates MNE-only tests

Acceptance criteria:

  • Tests assert EEGPrep channel-major data, ICA reconstruction, no stdout, and no temp leaks.
  • MNE-only tests are not skipped by EEGPREP_SKIP_MATLAB.
  • Tests fail for the current broken conversion behavior.

Activity

  1. added
    bug
    on Jun 10, 2026
  2. claude commented on Jun 10, 2026

    @claude
    Contributor

    🤖 Plan:

    Research

    The MNE conversion tests use shape-only checks and broad try/except blocks that turn AssertionError into skipTest, so the wrong data orientation (#178) and unmanaged temp files (#181) slip through. Both files also gate at module level on EEGPREP_SKIP_MATLAB, but neither test touches MATLAB — only MNE.

    Relevant code

    • tests/test_eeg_mne2eeg_epochs.py#L28-L29 — wrong MATLAB skip gate
    • tests/test_eeg_mne2eeg_epochs.py#L120-L124 — shape-only ICA assertions
    • tests/test_eeg_mne2eeg_epochs.py#L257 — asserts MNE order (n_epochs, n_channels, n_times)
    • tests/test_eeg_eeg2mne.py#L29-L30 — wrong MATLAB skip gate
    • tests/conftest.py#L63-L66 — files marked as matlab

    Proposed Fix

    Tighten the two test files so they assert the EEGPrep invariants (channel-major data, ICA mixing/unmixing algebra reconstructs data, no stdout, no leftover temp files) and stop catching AssertionError via try/except → skipTest. Drop the EEGPREP_SKIP_MATLAB module guards (they are MNE-only tests) and remove the two files from MATLAB_FILE_SUFFIXES in conftest.py. Mark assertions that exercise the bugs in #178/#181 with pytest.mark.xfail(strict=True, reason=...) so CI is green today and XPASS forces the marker removal when those fixes land. Test-only change; the converter code is owned by #178 and #181.

    PR

    #187

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions