[Numpy-discussion] Running NumPy tests from inside source tree fails

Albert Strasheim fullung at gmail.com
Thu May 4 23:21:15 EDT 2006


Hello all

I'm trying to run the NumPy tests from inside the source tree. This depends
on set_package_path() finding the package files I built.

According to the set_package_path documentation:

set_package_path should be called from a test_file.py that
satisfies the following tree structure:

    <somepath>/<somedir>/test_file.py

Then the first existing path name from the following list

    <somepath>/build/lib.<platform>-<version>
    <somepath>/..

My source tree (and probably everyone else's) looks like this:

numpy
numpy\build
numpy\build\lib.<platform>-<version>
...
numpy\core\tests\test_foo.py 

This means that set_package_path isn't going to do the right thing when
trying to run these tests. And indeed, I get an ImportError when I try.

A better strategy would probably be to search up from
dirname(abspath(testfile)) until you reach the current working directory,
instead of the hardcoded dirname(dirname(abspath(testfile)) currently being
used.

Pearu, think we could fix this (assuming it's broken and that I didn't miss
something obvious)?

Regards,

Albert





More information about the NumPy-Discussion mailing list