Skip to content

Commit 9b52d05

Browse files
committed
doctest: Avoid module-level testsetup, which conflicts with xdist
1 parent 19f20f8 commit 9b52d05

File tree

2 files changed

+13
-18
lines changed

2 files changed

+13
-18
lines changed

sdcflows/utils/epimanip.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,6 @@
2323
"""
2424
Manipulation of EPI data.
2525
26-
.. testsetup::
27-
28-
>>> tmpdir = getfixture('tmpdir')
29-
>>> tmp = tmpdir.chdir() # changing to a temporary directory
30-
>>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename(
31-
... tmpdir.join('epi.nii.gz').strpath)
32-
3326
"""
3427

3528

@@ -42,6 +35,15 @@ def get_trt(in_meta, in_file=None):
4235
The first option is that a ``TotalReadoutTime`` field is found
4336
in the JSON sidecar:
4437
38+
.. testsetup::
39+
40+
>>> cwd = os.getcwd()
41+
>>> tmpdir = getfixture('tmpdir')
42+
>>> tmp = tmpdir.chdir() # changing to a temporary directory
43+
>>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename(
44+
... tmpdir.join('epi.nii.gz').strpath)
45+
46+
4547
>>> meta = {'TotalReadoutTime': 0.05251}
4648
>>> get_trt(meta)
4749
0.05251
@@ -157,6 +159,10 @@ def get_trt(in_meta, in_file=None):
157159
Traceback (most recent call last):
158160
ValueError:
159161
162+
.. testcleanup::
163+
164+
>>> os.chdir(cwd)
165+
160166
.. admonition:: Thanks
161167
162168
With thanks to Dr. Rorden for his thorough

sdcflows/workflows/fit/syn.py

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@
2222
#
2323
"""
2424
Estimating the susceptibility distortions without fieldmaps.
25-
26-
.. testsetup::
27-
28-
>>> tmpdir = getfixture('tmpdir')
29-
>>> tmp = tmpdir.chdir() # changing to a temporary directory
30-
>>> data = np.zeros((10, 10, 10, 1, 3))
31-
>>> data[..., 1] = 1
32-
>>> nb.Nifti1Image(data, None, None).to_filename(
33-
... tmpdir.join('field.nii.gz').strpath)
34-
35-
3625
"""
3726
from nipype.pipeline import engine as pe
3827
from nipype.interfaces import utility as niu

0 commit comments

Comments
 (0)