[Numpy-discussion] setting package path

Stefan van der Walt stefan at sun.ac.za
Tue Feb 28 14:21:01 CST 2006


In numpytest.py, set_package_path is provided for handling path
changes while doing unit tests.  It reads

def set_package_path(level=1):
    """ Prepend package directory to sys.path.

    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>/..

    is prepended to sys.path.
...

However, the line that supposedly calculates "somepath/.." is

d = os.path.dirname(os.path.dirname(os.path.abspath(testfile)))

which calculates "somepath".  Which is wrong: the docstring, the code
or my interpretation?

Stéfan




More information about the Numpy-discussion mailing list