import speedup

Schönberger Johannes hannesschoenberger at gmail.com
Fri Dec 14 08:37:43 EST 2012


Good catch! Another approach would be to rewrite and rename `_setup_test` to `test` and either delete the 'test_verbose' function or write it as `test_verbose = functools.partial(test, verbose=True)` to ged rid of the rather complex setup/lambda routine.

Would you add a PR for this, please? I could do it as well, if you don't want…

Johannes Schönberger

Am 14.12.2012 um 04:42 schrieb Steven Silvester <steven.silvester at gmail.com>:

> Hey all, I noticed that loading skimage seemed to take a bit longer than I'd like, so I profiled it.  On my machine, it takes 1.6 seconds to import skimage, 0.4 of which was from numpy, and 1.2 of which was from loading nose in skimage/__init__.py.  This simple patch brings my import time down to ~0.4 seconds, since it only imports nose when the test function is called.
> 
> diff --git a/skimage/__init__.py b/skimage/__init__.py
> index 1ac121b..f3e5e88 100644
> --- a/skimage/__init__.py
> +++ b/skimage/__init__.py
> @@ -84,8 +84,9 @@ def _setup_test(verbose=False):
>          return f
>  
>  
> -test = _setup_test()
> -test_verbose = _setup_test(verbose=True)
> +test = lambda : _setup_test()()
> +test_verbose = lambda : _setup_test(verbose=True)()
> +test_verbose.__doc__ = test.__doc__ = 'Invoke the skimage test suite.'
>  
>  
>  def get_log(name=None):
> 
> 
> -- 
>  
>  




More information about the scikit-image mailing list