[Numpy-discussion] running numpy tests

Andrew Dalke dalke at dalkescientific.com
Mon Aug 4 21:41:11 EDT 2008


On Aug 5, 2008, at 2:00 AM, Robert Kern wrote:
> You have old stuff in your checkout/installation. Make sure you have
> deleted all of the *.pycs and directories which have been deleted in
> SVN.

Now that I've fixed that, I can tell that I made a
mistake related to the self-test code.  I can't figure
it out.

Many of the modules have code which look like

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

As I understand it, this code is migrating to use nosetests.
Because people expect 'import numpy; numpy.test()' to work,
there will be a compatibility period where this API is
unchanged.

I found that importing 'testing' costs 0.013 seconds, which
is 10% of my current import time.  I would like to defer
the import until needed, so I rewrote the 'test' code as:

     def test(label='fast', verbose=1, extra_argv=None, doctests=False,
              coverage=False, **kwargs):
         from testing import Tester
         import numpy
         Tester(numpy).test(label, verbose, extra_argv, doctests,
                            coverage, **kwargs)


In my view there's no difference between them, but Tester().test does  
introspection to figure out the module location.  (In fact, if I  
don't pass it the module explicitly then it expects that locals() 
["__file__"] for sys._getframe(-1) will exist, which is not the case  
with my function.  The underling code should instead check for that  
variable in globals().)

I ended up with recursion errors, and I don't know why.  Any idea of  
what to do?

[josiah:~] dalke% python -c 'import numpy; numpy.test()'
Running unit tests for numpy
NumPy version 1.2.0.dev5607
NumPy is installed in /Library/Frameworks/Python.framework/Versions/ 
2.5/lib/python2.5/site-packages/numpy
Python version 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1  
(Apple Computer, Inc. build 5341)]
nose version 0.10.3
Running unit tests for numpy
NumPy version 1.2.0.dev5607
NumPy is installed in /Library/Frameworks/Python.framework/Versions/ 
2.5/lib/python2.5/site-packages/numpy
Python version 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1  
(Apple Computer, Inc. build 5341)]
nose version 0.10.3
Running unit tests for numpy
NumPy version 1.2.0.dev5607
NumPy is installed in /Library/Frameworks/Python.framework/Versions/ 
2.5/lib/python2.5/site-packages/numpy

  ....

Python version 2.5 (r25:51918, Sep 19 2006, 08:49:13) [GCC 4.0.1  
(Apple Computer, Inc. build 5341)]
nose version 0.10.3
EEEEEEEEEEE
======================================================================
ERROR: numpy.test
----------------------------------------------------------------------
Traceback (most recent call last):
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/case.py", line  
182, in runTest
     self.test(*self.arg)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/numpy/__init__.py", line 107, in test
     coverage, **kwargs)
   File "/Users/dalke/cvses/numpy/build/lib.macosx-10.3-fat-2.5/numpy/ 
testing/nosetester.py", line 270, in test
     t = NumpyTestProgram(argv=argv, exit=False, plugins=plugins)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/core.py", line  
219, in __init__
     argv=argv, testRunner=testRunner, testLoader=testLoader)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/unittest.py", line 758, in __init__
     self.parseArgs(argv)

...



     return self.call(*arg, **kw)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/plugins/ 
manager.py", line 145, in simple
     result = meth(*arg, **kw)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/plugins/ 
attrib.py", line 214, in wantMethod
     return self.validateAttrib(attribs)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/plugins/ 
attrib.py", line 164, in validateAttrib
     if not value(key, attribs):
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/plugins/ 
attrib.py", line 118, in eval_in_context
     return eval(expr, None, ContextHelper(attribs))
   File "<string>", line 1, in <module>
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/plugins/ 
attrib.py", line 50, in __getitem__
     return self.obj.get(name, False)
   File "/Library/Frameworks/Python.framework/Versions/2.5/lib/ 
python2.5/site-packages/nose-0.10.3-py2.5.egg/nose/plugins/ 
attrib.py", line 66, in get
     log.debug('Get %s from %s.%s', name, self.cls, self.method)
RuntimeError: maximum recursion depth exceeded

>

				Andrew
				dalke at dalkescientific.com





More information about the NumPy-Discussion mailing list