From 4df09b2d82945ce147b3b2752f8e68d10e78c237 Mon Sep 17 00:00:00 2001 From: Christian O'Reilly Date: Fri, 15 Nov 2024 17:08:48 -0500 Subject: [PATCH] Removing some code duplication. --- pylossless/conftest.py | 2 +- pylossless/tests/test_bids.py | 24 +++--------------------- 2 files changed, 4 insertions(+), 22 deletions(-) diff --git a/pylossless/conftest.py b/pylossless/conftest.py index 2bec869..e27cd24 100644 --- a/pylossless/conftest.py +++ b/pylossless/conftest.py @@ -56,7 +56,7 @@ def pipeline_fixture(): @pytest.fixture(scope="session") @pytest.mark.filterwarnings("ignore:Converting data files to EDF format") def bids_dataset_fixture(tmpdir_factory): - """Make sure MNE's annotate_break function can run.""" + """Returns a BIDS path for a test recording.""" def edf_import_fct(path_in): # read in a file raw = mne.io.read_raw_edf(path_in, preload=True) diff --git a/pylossless/tests/test_bids.py b/pylossless/tests/test_bids.py index 2293ba2..9471e49 100644 --- a/pylossless/tests/test_bids.py +++ b/pylossless/tests/test_bids.py @@ -6,24 +6,6 @@ @pytest.mark.filterwarnings("ignore:Converting data files to EDF format") -def test_convert_dataset_to_bids(tmp_path): - """Make sure MNE's annotate_break function can run.""" - def edf_import_fct(path_in): - # read in a file - raw = mne.io.read_raw_edf(path_in, preload=True) - print(raw.annotations) - return raw, np.array([[0, 0, 0]]), {"test": 0, "T0": 1, "T1": 2, "T2": 3} - - testing_path = mne.datasets.testing.data_path() - fname = testing_path / "EDF" / "test_edf_overlapping_annotations.edf" - import_args = [{"path_in": fname}] - bids_path_args = [{'subject': '001', 'run': '01', 'session': '01', - "task": "test"}] - ll.bids.convert_dataset_to_bids( - edf_import_fct, - import_args, - bids_path_args, - bids_root=tmp_path / "bids_dataset", - overwrite=True - ) - shutil.rmtree(tmp_path / "bids_dataset") +def test_convert_dataset_to_bids(bids_dataset_fixture): + """Test the conversion of a recording to a BIDS dataset.""" + shutil.rmtree(bids_dataset_fixture.root) \ No newline at end of file