|
4 | 4 | from heudiconv.main import workflow
|
5 | 5 | from heudiconv import __version__
|
6 | 6 | from heudiconv.utils import (create_file_if_missing,
|
| 7 | + load_json, |
7 | 8 | set_readonly,
|
8 | 9 | is_readonly)
|
9 | 10 | from heudiconv.bids import (populate_bids_templates,
|
10 | 11 | add_participant_record,
|
11 | 12 | get_formatted_scans_key_row,
|
12 | 13 | add_rows_to_scans_keys_file,
|
13 |
| - find_subj_ses) |
| 14 | + find_subj_ses, |
| 15 | + SCANS_FILE_FIELDS, |
| 16 | + ) |
14 | 17 | from heudiconv.external.dlad import MIN_VERSION, add_to_datalad
|
15 | 18 |
|
16 | 19 | from .utils import TESTS_DATA_PATH
|
@@ -81,6 +84,8 @@ def test_populate_bids_templates(tmpdir):
|
81 | 84 | assert "something" not in description_file.read()
|
82 | 85 | assert "TODO" in description_file.read()
|
83 | 86 |
|
| 87 | + assert load_json(tmpdir / "scans.json") == SCANS_FILE_FIELDS |
| 88 | + |
84 | 89 |
|
85 | 90 | def test_add_participant_record(tmpdir):
|
86 | 91 | tf = tmpdir.join('participants.tsv')
|
@@ -127,6 +132,7 @@ def test_prepare_for_datalad(tmpdir):
|
127 | 132 | '.gitattributes',
|
128 | 133 | '.datalad/config', '.datalad/.gitattributes',
|
129 | 134 | 'dataset_description.json',
|
| 135 | + 'scans.json', |
130 | 136 | 'CHANGES', 'README'}
|
131 | 137 | assert set(ds.repo.get_indexed_files()) == target_files
|
132 | 138 | # and all are under git
|
@@ -217,7 +223,9 @@ def _check_rows(fn, rows):
|
217 | 223 | assert dates == sorted(dates)
|
218 | 224 |
|
219 | 225 | _check_rows(fn, rows)
|
220 |
| - assert op.exists(opj(tmpdir.strpath, 'file.json')) |
| 226 | + # we no longer produce a sidecar .json file there and only generate |
| 227 | + # it while populating templates for BIDS |
| 228 | + assert not op.exists(opj(tmpdir.strpath, 'file.json')) |
221 | 229 | # add a new one
|
222 | 230 | extra_rows = {
|
223 | 231 | 'a_new_file.nii.gz': ['2016adsfasd23', '', 'fasadfasdf'],
|
|
0 commit comments