|
7 | 7 |
|
8 | 8 | from glob import glob
|
9 | 9 | from os.path import join as pjoin, dirname
|
| 10 | +from pathlib import Path |
10 | 11 | import csv
|
11 | 12 | import re
|
12 | 13 |
|
| 14 | +from .. import __version__ |
| 15 | +from ..bids import HEUDICONV_VERSION_JSON_KEY |
| 16 | +from ..utils import load_json |
| 17 | + |
13 | 18 | import pytest
|
14 | 19 | from .utils import TESTS_DATA_PATH
|
15 | 20 |
|
@@ -140,16 +145,22 @@ def test_scout_conversion(tmpdir):
|
140 | 145 | ).split(' ') + ['-o', tmppath]
|
141 | 146 | runner(args)
|
142 | 147 |
|
143 |
| - assert not op.exists(pjoin( |
144 |
| - tmppath, |
145 |
| - 'Halchenko/Yarik/950_bids_test4/sub-phantom1sid1/ses-localizer/anat')) |
146 |
| - |
147 |
| - assert op.exists(pjoin( |
148 |
| - tmppath, |
149 |
| - 'Halchenko/Yarik/950_bids_test4/sourcedata/sub-phantom1sid1/' |
150 |
| - 'ses-localizer/anat/sub-phantom1sid1_ses-localizer_scout.dicom.tgz' |
151 |
| - ) |
152 |
| - ) |
| 148 | + dspath = Path(tmppath) / 'Halchenko/Yarik/950_bids_test4' |
| 149 | + sespath = dspath / 'sub-phantom1sid1/ses-localizer' |
| 150 | + |
| 151 | + assert not (sespath / 'anat').exists() |
| 152 | + assert ( |
| 153 | + dspath / |
| 154 | + 'sourcedata/sub-phantom1sid1/ses-localizer/' |
| 155 | + 'anat/sub-phantom1sid1_ses-localizer_scout.dicom.tgz' |
| 156 | + ).exists() |
| 157 | + |
| 158 | + # Let's do some basic checks on produced files |
| 159 | + j = load_json(sespath / 'fmap/sub-phantom1sid1_ses-localizer_acq-3mm_phasediff.json') |
| 160 | + # We store HeuDiConv version in each produced .json file |
| 161 | + # TODO: test that we are not somehow overwritting that version in existing |
| 162 | + # files which we have not produced in a particular run. |
| 163 | + assert j[HEUDICONV_VERSION_JSON_KEY] == __version__ |
153 | 164 |
|
154 | 165 |
|
155 | 166 | @pytest.mark.parametrize(
|
|
0 commit comments