Skip to content

Rewrite testing code that makes use of ernoise FIF file #1405

Open
@hoechenberger

Description

@hoechenberger

EDIT

please see: #1406 (comment)

The affected code must be re-written to not save data into mne datasets.


I'm on main, I deleted my entire ~/mne_data directory and downloaded the latest testing dataset. I want to run all tests in test_write.py.

All of them complete successfully, except for test_anonymize_dataset():

Running pytest with args: ['-p', 'vscode_pytest', '--rootdir=/Users/richardhochenberger/Development/mne-bids', '/Users/richardhochenberger/Development/mne-bids/mne_bids/tests/test_write.py::test_anonymize_dataset']
============================= test session starts ==============================
platform darwin -- Python 3.12.10, pytest-8.3.5, pluggy-1.6.0
rootdir: /Users/richardhochenberger/Development/mne-bids
configfile: pyproject.toml
plugins: anyio-4.9.0, sugar-1.0.0, cov-6.1.1
collected 1 item

mne_bids/tests/test_write.py F                                           [100%]

=================================== FAILURES ===================================
____________________________ test_anonymize_dataset ____________________________
mne_bids/tests/test_write.py:3795: in test_anonymize_dataset
    raw_er = _read_raw_fif(raw_er_path, verbose=False)
mne_bids/tests/test_write.py:105: in fn
    raw = read_raw(fname, *args, **kwargs)
../mne-python/mne/io/fiff/raw.py:543: in read_raw_fif
    return Raw(
<decorator-gen-273>:10: in __init__
    ???
../mne-python/mne/io/fiff/raw.py:103: in __init__
    raw, next_fname, buffer_size_sec = self._read_raw_file(
<decorator-gen-274>:12: in _read_raw_file
    ???
../mne-python/mne/io/fiff/raw.py:198: in _read_raw_file
    fname = _check_fname(fname, "read", True, "fname")
<decorator-gen-0>:12: in _check_fname
    ???
../mne-python/mne/utils/check.py:302: in _check_fname
    raise FileNotFoundError(f'{name} does not exist: "{fname}"')
E   FileNotFoundError: fname does not exist: "/Users/richardhochenberger/mne_data/MNE-testing-data/MEG/sample/ernoise_raw.fif"
- generated xml file: /Users/richardhochenberger/Development/mne-bids/junit-results.xml -
============================= slowest 20 durations =============================
0.04s call     mne_bids/tests/test_write.py::test_anonymize_dataset

(2 durations < 0.005s hidden.  Use -vv to show these durations.)
=========================== short test summary info ============================
FAILED mne_bids/tests/test_write.py::test_anonymize_dataset - FileNotFoundErr...
============================== 1 failed in 0.60s ===============================
Finished running tests!

And indeed, MNE-testing-data/MEG/sample/ernoise_raw.fif doesn't exist because it's not even supposed to be included in the dataset, at least I cannot find it in the repo:

https://github.com/mne-tools/mne-testing-data/tree/master/MEG/sample

So … what gives?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions