[Numpy-discussion] "import numpy" is slow

Andrew Dalke dalke@dalkescientific....
Thu Jul 31 00:56:14 CDT 2008

On Jul 31, 2008, at 4:21 AM, Alan McIntyre wrote:
> They actually do two different things; numpy.test() runs test for all
> of numpy, and numpy.testing.test() runs tests for numpy.testing only.
> There are similar functions in numpy.lib, numpy.core, etc.

Really?  This is the code from numpy/__init__.py:

     from testing import Tester
     test = Tester().test
     bench = Tester().bench

This is the code from numpy/testing/__init__.py:

test = Tester().test

... ahhh, here's the magic, from testing/nosetester.py:NoseTester

         if package is None:
             f = sys._getframe(1)
             package = f.f_locals.get('__file__', None)
             assert package is not None
             package = os.path.dirname(package)

Why are 'test' and 'bench' part of the general API instead something  
only used during testing?


More information about the Numpy-discussion mailing list