From 02a26db4534050c682736060c4a35b9f7badf8df Mon Sep 17 00:00:00 2001 From: wilsaj Date: Fri, 20 Jul 2012 12:26:17 -0500 Subject: [PATCH 1/2] remove message about not being able to load nose; fixes #218 --- skimage/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/skimage/__init__.py b/skimage/__init__.py index a3deb6c6..c760690c 100644 --- a/skimage/__init__.py +++ b/skimage/__init__.py @@ -72,7 +72,6 @@ def _setup_test(verbose=False): try: import nose as _nose except ImportError: - print("Could not load nose. Unit tests not available.") return None else: f = functools.partial(_nose.run, 'skimage', argv=args) From 86f67f85edfbd6acd80e4ff76c15db6c060ec4de Mon Sep 17 00:00:00 2001 From: wilsaj Date: Fri, 20 Jul 2012 14:45:51 -0500 Subject: [PATCH 2/2] raise an import error if trying to run test suite without nose --- skimage/__init__.py | 19 +++++++------------ 1 file changed, 7 insertions(+), 12 deletions(-) diff --git a/skimage/__init__.py b/skimage/__init__.py index c760690c..ad37f425 100644 --- a/skimage/__init__.py +++ b/skimage/__init__.py @@ -72,25 +72,20 @@ def _setup_test(verbose=False): try: import nose as _nose except ImportError: - return None + def broken_test_func(): + """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.") + return broken_test_func else: f = functools.partial(_nose.run, 'skimage', argv=args) f.__doc__ = 'Invoke the skimage test suite.' return f -test = _setup_test() -if test is None: - try: - del test - except NameError: - pass +test = _setup_test() test_verbose = _setup_test(verbose=True) -if test_verbose is None: - try: - del test - except NameError: - pass def get_log(name=None):