Skip to content

Commit

Permalink
doctest: Avoid module-level testsetup, which conflicts with xdist
Browse files Browse the repository at this point in the history
  • Loading branch information
effigies committed Sep 24, 2024
1 parent 19f20f8 commit 9b52d05
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 18 deletions.
20 changes: 13 additions & 7 deletions sdcflows/utils/epimanip.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,6 @@
"""
Manipulation of EPI data.
.. testsetup::
>>> tmpdir = getfixture('tmpdir')
>>> tmp = tmpdir.chdir() # changing to a temporary directory
>>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename(
... tmpdir.join('epi.nii.gz').strpath)
"""


Expand All @@ -42,6 +35,15 @@ def get_trt(in_meta, in_file=None):
The first option is that a ``TotalReadoutTime`` field is found
in the JSON sidecar:
.. testsetup::
>>> cwd = os.getcwd()
>>> tmpdir = getfixture('tmpdir')
>>> tmp = tmpdir.chdir() # changing to a temporary directory
>>> nb.Nifti1Image(np.zeros((90, 90, 60)), None, None).to_filename(
... tmpdir.join('epi.nii.gz').strpath)
>>> meta = {'TotalReadoutTime': 0.05251}
>>> get_trt(meta)
0.05251
Expand Down Expand Up @@ -157,6 +159,10 @@ def get_trt(in_meta, in_file=None):
Traceback (most recent call last):
ValueError:
.. testcleanup::
>>> os.chdir(cwd)
.. admonition:: Thanks
With thanks to Dr. Rorden for his thorough
Expand Down
11 changes: 0 additions & 11 deletions sdcflows/workflows/fit/syn.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,6 @@
#
"""
Estimating the susceptibility distortions without fieldmaps.
.. testsetup::
>>> tmpdir = getfixture('tmpdir')
>>> tmp = tmpdir.chdir() # changing to a temporary directory
>>> data = np.zeros((10, 10, 10, 1, 3))
>>> data[..., 1] = 1
>>> nb.Nifti1Image(data, None, None).to_filename(
... tmpdir.join('field.nii.gz').strpath)
"""
from nipype.pipeline import engine as pe
from nipype.interfaces import utility as niu
Expand Down

0 comments on commit 9b52d05

Please sign in to comment.