Skip to content

Commit

Permalink
Fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeZiminski committed Oct 24, 2023
1 parent 69ea739 commit efa67ad
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 24 deletions.
14 changes: 7 additions & 7 deletions tests/tests_integration/file_conflicts_pathtable.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@ def get_pathtable(base_folder):
[base_folder, Path("rawdata") / "sub-001" / "ses-003_date-20231901" / "behav" / "behav.csv", False, False, False, "sub-001", "ses-003_date-20231901", "behav"],
[base_folder, Path("rawdata") / "sub-001" / "ses-003_date-20231901" / "ephys" / "ephys.bin", False, False, False, "sub-001", "ses-003_date-20231901", "ephys"],
[base_folder, Path("rawdata") / "sub-001" / "ses-003_date-20231901" / "non_data" / "non_data.mp4", False, False, True, "sub-001", "ses-003_date-20231901", None],
[base_folder, Path("rawdata") / "sub-001" / "ses-003_date-20231901" / "nondatatype_level_file.csv", False, False, True, "sub-001", "ses-003_date-20231901", None],
[base_folder, Path("rawdata") / "sub-001" / "ses-003_date-20231901" / "nondatatype_level_file.csv", False, False, True, "sub-001", "ses-003_date-20231901", None],
[base_folder, Path("rawdata") / "sub-001" / "random-ses_level_file.mp4", False, True, False, "sub-001", None, None],
[base_folder, Path("rawdata") / "sub-001" / "anat" / "sub-001_anat.file", False, False, False, "sub-001", None, "anat"],
[base_folder, Path("rawdata") / "sub-001" / "ses-004" / "anat" / "sub-001_anat.file", False, False, False, "sub-001", "ses-004", "anat"],
[base_folder, Path("rawdata") / "sub-002_random-value" / "sub-002_random-value.file", False, True, False, "sub-002_random-value", None, None],
[base_folder, Path("rawdata") / "sub-002_random-value" / "ses-001" / "non_datatype_level_folder" / "file.csv", False, False, True, "sub-002_random-value", "ses-001", None],
[base_folder, Path("rawdata") / "sub-002_random-value" / "ses-001" / "non_datatype_level_folder" / "file.csv", False, False, True, "sub-002_random-value", "ses-001", None],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "ses-001" / "funcimg" / ".myfile.xlsx", False, False, False, "sub-003_date-20231901", "ses-001", "funcimg"],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "ses-003_date-20231901" / "nondatatype_level_file.csv", False, False, True, "sub-003_date-20231901", "ses-003_date-20231901", None],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "ses-003_date-20231901" / "nondatatype_level_file.csv", False, False, True, "sub-003_date-20231901", "ses-003_date-20231901", None],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "ses-003_date-20231901" / "funcimg" / "funcimg.nii", False, False, False, "sub-003_date-20231901", "ses-003_date-20231901", "funcimg"],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "seslevel_non-prefix_folder" / "nonlevel.mat", False, True, False, "sub-003_date-20231901", "seslevel_non-prefix_folder", None],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "seslevel_non-prefix_folder" / "nonlevel.mat", False, True, False, "sub-003_date-20231901", "seslevel_non-prefix_folder", None],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "sub-ses-level_file.txt", False, True, False, "sub-003_date-20231901", None, None],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "anat" / ".anat.file", False, False, False, "sub-003_date-20231901", None, "anat"],
[base_folder, Path("rawdata") / "sub-003_date-20231901" / "ses-004" / "anat" / ".anat.file", False, False, False, "sub-003_date-20231901", "ses-004", "anat"],
[base_folder, Path("rawdata") / "project_level_file.txt", True, False, False, None, None, None],
[base_folder, Path("rawdata") / "sublevel_non_sub-prefix_folder" / "ses_non_folder.file", True, False, False, None, None, None],
[base_folder, Path("rawdata") / "sublevel_non_sub-prefix_folder" / "ses_non_folder.file", True, False, False, None, None, None],
]


Expand Down
4 changes: 2 additions & 2 deletions tests/tests_integration/test_filesystem_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -429,10 +429,10 @@ def test_rclone_overwrite_modified_file(
the version in source is newer than target.
"""
path_to_test_file = (
Path("rawdata") / "sub-001" / "anat" / "test_file.txt"
Path("rawdata") / "sub-001" / "ses-001" / "anat" / "test_file.txt"
)

project.make_folders("sub-001", datatype="anat")
project.make_folders("sub-001", "ses-001", datatype="anat")

local_test_file_path = project.cfg["local_path"] / path_to_test_file
central_test_file_path = (
Expand Down
6 changes: 3 additions & 3 deletions tests/tests_integration/test_logging.py
Original file line number Diff line number Diff line change
Expand Up @@ -286,9 +286,9 @@ def test_logs_upload_and_download(

assert "Using config file from" in log
assert "Local file system at" in log

assert """ "--include" "sub-11/anat/**" """ in log
assert """/central/test_project/rawdata""" in log
assert "--include" in log
assert "sub-11/ses-123/anat/**" in log
assert "/central/test_project/rawdata" in log
assert "Waiting for checks to finish" in log

@pytest.mark.parametrize("upload_or_download", ["upload", "download"])
Expand Down
17 changes: 10 additions & 7 deletions tests/tests_integration/test_make_folders.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ def test_explicitly_session_list(self, project):
test_utils.check_and_cd_folder(
join(base_folder, sub, ses, "funcimg")
)
test_utils.check_and_cd_folder(join(base_folder, sub, "anat"))
test_utils.check_and_cd_folder(
join(base_folder, sub, ses, "anat")
)

@pytest.mark.parametrize("behav", [True, False])
@pytest.mark.parametrize("ephys", [True, False])
Expand Down Expand Up @@ -210,7 +212,9 @@ def test_custom_folder_names(self, project):
join(base_folder, sub, ses, "change_funcimg")
)

test_utils.check_and_cd_folder(join(base_folder, sub, "change_anat"))
test_utils.check_and_cd_folder(
join(base_folder, sub, ses, "change_anat")
)

@pytest.mark.parametrize(
"files_to_test",
Expand Down Expand Up @@ -238,13 +242,10 @@ def test_datatypes_subsection(self, project, files_to_test):
base_folder = test_utils.get_top_level_folder_path(project)

# Check at the subject level
sub_file_names = test_utils.glob_basenames(
test_utils.glob_basenames(
join(base_folder, sub, "*"),
exclude=ses,
)
if "anat" in files_to_test:
assert "anat" in sub_file_names
files_to_test.remove("anat")

# Check at the session level
ses_file_names = test_utils.glob_basenames(
Expand All @@ -253,7 +254,9 @@ def test_datatypes_subsection(self, project, files_to_test):
)

if files_to_test == ["all"]:
assert ses_file_names == sorted(["ephys", "behav", "funcimg"])
assert ses_file_names == sorted(
["ephys", "behav", "funcimg", "anat"]
)
else:
assert ses_file_names == sorted(files_to_test)

Expand Down
5 changes: 0 additions & 5 deletions tests/tests_integration/test_ssh_file_transfer.py
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,6 @@ def make_pathtable_search_filter(self, sub_names, ses_names, datatype):
if sub == "all_non_sub":
extra_arguments += ["is_non_sub == True"]
else:
if "anat" in datatype:
sub_ses_dtype_arguments += [
f"(parent_sub == '{sub}' & (parent_datatype == 'anat' | parent_datatype == 'anat'))"
]

for ses in ses_names:
if ses == "all_non_ses":
extra_arguments += [
Expand Down

0 comments on commit efa67ad

Please sign in to comment.