File tree 1 file changed +10
-10
lines changed
1 file changed +10
-10
lines changed Original file line number Diff line number Diff line change 36
36
"""
37
37
38
38
# 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
+ }
42
44
43
45
def setup_package ():
44
46
""" Set numpy print style to legacy="1.13" for newer versions of numpy """
45
- import nibabel as nb
46
47
import numpy as np
47
48
from distutils .version import LooseVersion
48
- if nb ._save_printopts is None :
49
- nb ._save_printopts = np .get_printoptions ().get ('legacy' )
50
49
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' )
51
52
np .set_printoptions (legacy = "1.13" )
52
53
53
54
def teardown_package ():
54
55
""" Reset print options when tests finish """
55
- import nibabel as nb
56
56
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
60
60
61
61
62
62
# module imports
You can’t perform that action at this time.
0 commit comments