Skip to content

Commit

Permalink
fix glob patterns for #739 induced regression
Browse files Browse the repository at this point in the history
  • Loading branch information
bpinsard committed Oct 21, 2024
1 parent 7200a0b commit 8da2b43
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
6 changes: 3 additions & 3 deletions heudiconv/external/dlad.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,12 @@ def add_to_datalad(

# Provide metadata for sensitive information
sensitive_patterns = [
"sourcedata",
"sourcedata/**",
"*_scans.tsv", # top level
"*/*_scans.tsv", # within subj
"*/*/*_scans.tsv", # within sess/subj
"*/anat", # within subj
"*/*/anat", # within ses/subj
"*/anat/*", # within subj
"*/*/anat/*", # within ses/subj
]
for sp in sensitive_patterns:
mark_sensitive(ds, sp, annexed_files)
Expand Down
13 changes: 13 additions & 0 deletions heudiconv/tests/test_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def test_conversion(
heuristic,
anon_cmd,
template="sourcedata/sub-{subject}/*/*/*.tgz",
xargs=["--datalad"],
)
runner(args) # run conversion

Expand Down Expand Up @@ -96,6 +97,18 @@ def test_conversion(
for key in keys:
assert orig[key] == conv[key]

# validate sensitive marking
from datalad.api import Dataset

ds = Dataset(outdir)
all_meta = dict(ds.repo.get_metadata("."))
target_rec = {"distribution-restrictions": ["sensitive"]}
for pth, meta in all_meta.items():
if "anat" in pth or "scans.tsv" in pth:
assert meta == target_rec
else:
assert meta == {}


@pytest.mark.skipif(not have_datalad, reason="no datalad")
def test_multiecho(
Expand Down

0 comments on commit 8da2b43

Please sign in to comment.