diff --git a/skimage/__init__.py b/skimage/__init__.py index 3277919e..daac238c 100644 --- a/skimage/__init__.py +++ b/skimage/__init__.py @@ -52,8 +52,8 @@ img_as_ubyte """ import os.path as _osp -import imp -import functools +import imp as _imp +import functools as _functools pkg_dir = _osp.abspath(_osp.dirname(__file__)) data_dir = _osp.join(pkg_dir, 'data') @@ -65,15 +65,15 @@ except ImportError: try: - imp.find_module('nose') + _imp.find_module('nose') except ImportError: - def test(verbose=False): + def _test(verbose=False): """This would invoke the skimage test suite, but nose couldn't be imported so the test suite can not run. """ - raise ImportError("Could not load nose. Unit tests not available.") + raise ImportError("Could not load nose. Unit tests not available.") else: - def test(verbose=False): + def _test(verbose=False): """Invoke the skimage test suite.""" import nose args = ['', pkg_dir, '--exe'] @@ -81,7 +81,10 @@ else: args.extend(['-v', '-s']) nose.run('skimage', argv=args) -test_verbose = functools.partial(test, verbose=True) +# do not use `test` as function name as this leads to a recursion problem with +# the nose test suite +test = _test +test_verbose = _functools.partial(test, verbose=True) test_verbose.__doc__ = test.__doc__