From b53219a73b6a4a745feaf1f15b4dd72088cb270f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erkka=20Heinil=C3=A4?= Date: Fri, 1 Mar 2024 18:41:31 +0200 Subject: [PATCH] Try fixing some of the tests needing write permissions --- meggie/utilities/testing.py | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/meggie/utilities/testing.py b/meggie/utilities/testing.py index dbc644a5..3fb06ef5 100644 --- a/meggie/utilities/testing.py +++ b/meggie/utilities/testing.py @@ -57,22 +57,20 @@ def create_experiment( prefs.workspace = experiment_folder # create experiment (creates experiment directory inside working directory) - name = experiment_name - author = "Test" experiment = initialize_new_experiment( - name, author, prefs, set_previous_experiment=False + experiment_name, "Test", prefs, set_previous_experiment=False ) for subject_idx, raw in enumerate(subjects_raw): - with tempfile.TemporaryDirectory() as sample_folder: + sample_name = "sample_" + str(subject_idx + 1).zfill(2) + "-raw" + sample_folder = os.path.join(experiment_folder, experiment_name, sample_name) + os.makedirs(sample_folder) + fname = sample_name + ".fif" - fname = "sample_" + str(subject_idx + 1).zfill(2) + "-raw.fif" + raw_path = os.path.join(sample_folder, fname) + raw.save(raw_path) - raw_path = os.path.join(sample_folder, fname) - raw.save(raw_path) - - subject_name = fname.split(".fif")[0] - experiment.create_subject(subject_name, raw_path) + experiment.create_subject(sample_name, raw_path) experiment.save_experiment_settings() return experiment