On Sat, Jul 31, 2010 at 4:55 AM, Robert Kern <robert.kern@gmail.com> wrote:
On Fri, Jul 30, 2010 at 13:22, Darren Dale <dsdale24@gmail.com> wrote:
> I just upgraded my svn checkout and did a fresh install. When I try to
> run the test suite, I get a ton of errors:
>
>
> np.test()
> Running unit tests for numpy
> NumPy version 2.0.0.dev8550
> NumPy is installed in /Users/darren/.local/lib/python2.6/site-packages/numpy
> Python version 2.6.5 (r265:79063, Jul 19 2010, 09:08:11) [GCC 4.2.1
> (Apple Inc. build 5659)]
> nose version 0.11.3
> ................................................................................................................Reloading
> numpy.lib
> Reloading numpy.lib.info
> Reloading numpy.lib.numpy
> Reloading numpy
> Reloading numpy.numpy
> Reloading numpy.show
> EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE
> ======================================================================
>
> [...]
>
>  File "/Users/darren/.local/lib/python2.6/site-packages/numpy/lib/__init__.py",
> line 23, in <module>
>    __all__ += type_check.__all__
> NameError: name 'type_check' is not defined
>
>
> I checked numpy/lib/__init__.py, and it does a bunch of imports like
> "from type_check import *" but not "import type_check", which are
> needed to append to __all__.

Not quite. The code does work, as-is, in most situations thanks to a
detail of Python's import system. When a submodule is imported in a
package, whether through a direct "import package.submodule" or "from
submodule import *", Python will take the created module object and
assign it into the package.__init__'s namespace with the appropriate
name. So while the code doesn't look correct, it usually is correct.

The problem is test_getlimits.py:

import numpy.lib
try:
   reload(numpy.lib)
except NameError:
   # Py3K
   import imp
   imp.reload(numpy.lib)

These are causing reloads of the hierarchy under numpy.lib and are
presumably interfering with the normal import process (for some
reason). Does anyone know why we reload(numpy.lib) here? The log
history is unhelpful. It goes back to when this code was in scipy. I
suspect that we can just remove it.

If no one remembers, can we remove this before the 1.5.0 beta (i.e. tomorrow) so it gets tested enough before the final release?

Tested on OS X with python 2.6.5 and 3.1, no problems after removing it.

Ralf
 

That said, there is no real cost to both explicitly importing the
submodule and importing * from the submodule.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
  -- Umberto Eco
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion