File tree Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Expand file tree Collapse file tree 1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 3636"""
3737
3838# Package-wide test setup and teardown
39- # Numpy changed print options in 1.14; we can update docstrings and remove
40- # these when our minimum for building docs exceeds that
41- _save_printopts = None
39+ _test_states = {
40+ # Numpy changed print options in 1.14; we can update docstrings and remove
41+ # these when our minimum for building docs exceeds that
42+ 'legacy_printopt' : None ,
43+ }
4244
4345def setup_package ():
4446 """ Set numpy print style to legacy="1.13" for newer versions of numpy """
45- import nibabel as nb
4647 import numpy as np
4748 from distutils .version import LooseVersion
48- if nb ._save_printopts is None :
49- nb ._save_printopts = np .get_printoptions ().get ('legacy' )
5049 if LooseVersion (np .__version__ ) >= LooseVersion ('1.14' ):
50+ if _test_states .get ('legacy_printopt' ) is None :
51+ _test_states ['legacy_printopt' ] = np .get_printoptions ().get ('legacy' )
5152 np .set_printoptions (legacy = "1.13" )
5253
5354def teardown_package ():
5455 """ Reset print options when tests finish """
55- import nibabel as nb
5656 import numpy as np
57- if nb . _save_printopts is not None :
58- np .set_printoptions (legacy = nb . _save_printopts )
59- nb . _save_printopts = None
57+ if _test_states . get ( 'legacy_printopt' ) is not None :
58+ np .set_printoptions (legacy = _test_states [ 'legacy_printopt' ] )
59+ _test_states [ 'legacy_printopt' ] = None
6060
6161
6262# module imports
You can’t perform that action at this time.
0 commit comments