From 2bd45ed6e30d309b60f52cfa556229f4d1c09150 Mon Sep 17 00:00:00 2001 From: Recorder Laptop Date: Thu, 8 Jan 2026 09:05:50 +0100 Subject: [PATCH 1/7] for some reason (maybe newer datalad version) I had to modify both commands to work --- lslautobids/datalad_create.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lslautobids/datalad_create.py b/lslautobids/datalad_create.py index 830c8d0..6f066b8 100644 --- a/lslautobids/datalad_create.py +++ b/lslautobids/datalad_create.py @@ -7,7 +7,7 @@ def create_and_add_files_to_datalad_dataset(dataset_path,logger): #if flag==0: try: - dl.Dataset(dataset_path) + dl.Dataset(dataset_path).status() except: message ="LSL Auto BIDS: new datalad dataset created" # Create a new dataset @@ -30,5 +30,6 @@ def create_and_add_files_to_datalad_dataset(dataset_path,logger): # commit current files logger.info('Committing current changes........') + os.chdir(dataset_path) # bug in datalad that requires to be in the same folder to save the datalad thingy dl.save(path = dataset_path, message=message) From 48074705e357e94009e5839abebec88819395262 Mon Sep 17 00:00:00 2001 From: Benedikt Ehinger Date: Tue, 24 Feb 2026 14:15:31 +0100 Subject: [PATCH 2/7] Fix cleanup by uncommenting bids_root removal Uncommented the shutil.rmtree call for bids_root cleanup. --- tests/test_main_functionality/test_main_functionality.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_main_functionality/test_main_functionality.py b/tests/test_main_functionality/test_main_functionality.py index 719d82c..f766cf6 100644 --- a/tests/test_main_functionality/test_main_functionality.py +++ b/tests/test_main_functionality/test_main_functionality.py @@ -63,6 +63,6 @@ def test_process_main_functionality(setup_project, monkeypatch): # cleanup shutil.rmtree(os.path.join(paths["project_root"], project_name,"sub-100")) - #shutil.rmtree(paths["bids_root"]) + shutil.rmtree(paths["bids_root"]) From 3422de09540641ff9c6e62c4589f547cdf3b20c6 Mon Sep 17 00:00:00 2001 From: Benedikt Ehinger Date: Tue, 24 Feb 2026 20:59:56 +0100 Subject: [PATCH 3/7] removed the cleanup stage, because for some reason it interferes with the git-annex permission system. in CI it shouldnt be a prolbem --- tests/test_old_suffix/test_old_suffix.py | 2 +- tests/test_otherfiles-renaming/test_otherfiles-renaming.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_old_suffix/test_old_suffix.py b/tests/test_old_suffix/test_old_suffix.py index d1a44bd..8c6014d 100644 --- a/tests/test_old_suffix/test_old_suffix.py +++ b/tests/test_old_suffix/test_old_suffix.py @@ -28,7 +28,7 @@ def test_process_new_files_with_old_suffix(setup_project, monkeypatch): paths = get_root_paths(__file__) monkeypatch_paths(monkeypatch,paths) - + print("XXXXXXXXXXXXXXXXXXXX") # Reset sys.argv to something that lslautobids.main.main() expects sys.argv = [ "lslautobids.main", diff --git a/tests/test_otherfiles-renaming/test_otherfiles-renaming.py b/tests/test_otherfiles-renaming/test_otherfiles-renaming.py index 01e8865..b41f443 100644 --- a/tests/test_otherfiles-renaming/test_otherfiles-renaming.py +++ b/tests/test_otherfiles-renaming/test_otherfiles-renaming.py @@ -45,6 +45,6 @@ def test_process_otherfiles_renaming(setup_project, monkeypatch): lslautobids.main.main() # cleanup - shutil.rmtree(paths["bids_root"]) + #shutil.rmtree(paths["bids_root"]) From f21fc32e5514cbc1a30f345f7b324da38ef7278f Mon Sep 17 00:00:00 2001 From: Benedikt Ehinger Date: Tue, 24 Feb 2026 21:10:39 +0100 Subject: [PATCH 4/7] removed the yaml file and added to gitignore --- .gitignore | 1 + tests/pytest-autobids_config.yaml | 3 --- 2 files changed, 1 insertion(+), 3 deletions(-) delete mode 100644 tests/pytest-autobids_config.yaml diff --git a/.gitignore b/.gitignore index cfa822b..bdc95a7 100644 --- a/.gitignore +++ b/.gitignore @@ -9,6 +9,7 @@ empty_log_process_temp.py tests/**/bids/ tests/test_main_functionality/data/projects/test-project/sub-100 +tests/pytest-autobids_config.yaml tests/data # Byte-compiled / optimized / DLL files __pycache__/ diff --git a/tests/pytest-autobids_config.yaml b/tests/pytest-autobids_config.yaml deleted file mode 100644 index c18e2aa..0000000 --- a/tests/pytest-autobids_config.yaml +++ /dev/null @@ -1,3 +0,0 @@ -BIDS_ROOT: /Users/xuyg/GitHub/LSLAutoBIDS/tests/data/bids -PROJECT_OTHER_ROOT: /Users/xuyg/GitHub/LSLAutoBIDS/tests/data/project_other -PROJECT_ROOT: /Users/xuyg/GitHub/LSLAutoBIDS/tests/data/projects From 526d9c2b4809711bf6f750a59be7aefa9e96678a Mon Sep 17 00:00:00 2001 From: Benedikt Ehinger Date: Tue, 24 Feb 2026 21:10:50 +0100 Subject: [PATCH 5/7] again removed the cleanup... --- tests/test_main_functionality/test_main_functionality.py | 6 ++++-- tests/test_otherfiles-renaming/test_otherfiles-renaming.py | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/test_main_functionality/test_main_functionality.py b/tests/test_main_functionality/test_main_functionality.py index 1ae94ce..40d6038 100644 --- a/tests/test_main_functionality/test_main_functionality.py +++ b/tests/test_main_functionality/test_main_functionality.py @@ -64,8 +64,10 @@ def test_process_main_functionality(setup_project, monkeypatch): fixture_path = os.path.join(paths["bids_root"],project_name,"sub-100","ses-001","eeg","sub-100_ses-001_task-freeviewing_run-2_eeg.set") assert os.path.exists(fixture_path) - # cleanup + # cleanup shutil.rmtree(os.path.join(paths["project_root"], project_name,"sub-100")) - shutil.rmtree(paths["bids_root"]) + + # # doesnt work for some reason with git-annex, needs sudo + #shutil.rmtree(paths["bids_root"]) diff --git a/tests/test_otherfiles-renaming/test_otherfiles-renaming.py b/tests/test_otherfiles-renaming/test_otherfiles-renaming.py index b41f443..fe51f27 100644 --- a/tests/test_otherfiles-renaming/test_otherfiles-renaming.py +++ b/tests/test_otherfiles-renaming/test_otherfiles-renaming.py @@ -44,7 +44,7 @@ def test_process_otherfiles_renaming(setup_project, monkeypatch): import lslautobids.main lslautobids.main.main() - # cleanup + # cleanup # doesnt work for some reason with git-annex, needs sudo #shutil.rmtree(paths["bids_root"]) From f046a258c97222f63a27528b21d84ba583c599d5 Mon Sep 17 00:00:00 2001 From: Benedikt Ehinger Date: Tue, 24 Feb 2026 21:16:55 +0100 Subject: [PATCH 6/7] push to global path --- .github/workflows/pytest.yml | 2 +- tests/conftest.py | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index abd123d..78caead 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -26,4 +26,4 @@ jobs: run: uv pip install --editable ./ - name: Run tests with uv - run: uv run pytest \ No newline at end of file + run: uv run pytest tests \ No newline at end of file diff --git a/tests/conftest.py b/tests/conftest.py index 3523e2e..8639661 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -35,8 +35,8 @@ def setup_project(monkeypatch): from lslautobids.gen_project_config import main as gen_project_config_main - # Create dummy user config for the test - config_file_test = ("tests/pytest-autobids_config.yaml") + # Create dummy user config for the test using absolute path + config_file_test = os.path.join(PROJECT_ROOT, "pytest-autobids_config.yaml") #os.makedirs(os.path.dirname(config_file_test), exist_ok=True) config_data = { From 819176912682a5add6e54ec80444aa5520274799 Mon Sep 17 00:00:00 2001 From: Benedikt Ehinger Date: Tue, 24 Feb 2026 21:18:36 +0100 Subject: [PATCH 7/7] nitpicky tests... --- tests/test_main_functionality/test_main_functionality.py | 2 +- tests/test_otherfiles-renaming/test_otherfiles-renaming.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/test_main_functionality/test_main_functionality.py b/tests/test_main_functionality/test_main_functionality.py index 40d6038..614fb8d 100644 --- a/tests/test_main_functionality/test_main_functionality.py +++ b/tests/test_main_functionality/test_main_functionality.py @@ -67,7 +67,7 @@ def test_process_main_functionality(setup_project, monkeypatch): # cleanup shutil.rmtree(os.path.join(paths["project_root"], project_name,"sub-100")) - # # doesnt work for some reason with git-annex, needs sudo + # # does not work for some reason with git-annex, needs sudo #shutil.rmtree(paths["bids_root"]) diff --git a/tests/test_otherfiles-renaming/test_otherfiles-renaming.py b/tests/test_otherfiles-renaming/test_otherfiles-renaming.py index fe51f27..974eac7 100644 --- a/tests/test_otherfiles-renaming/test_otherfiles-renaming.py +++ b/tests/test_otherfiles-renaming/test_otherfiles-renaming.py @@ -44,7 +44,7 @@ def test_process_otherfiles_renaming(setup_project, monkeypatch): import lslautobids.main lslautobids.main.main() - # cleanup # doesnt work for some reason with git-annex, needs sudo + # cleanup # does not work for some reason with git-annex, needs sudo #shutil.rmtree(paths["bids_root"])