[Python-Dev] Re: test_import failing

Fred L. Drake, Jr. fdrake@beopen.com
Mon, 9 Oct 2000 22:20:11 -0400 (EDT)


Jeremy Hylton writes:
 > Unless you are having a different problem, this isn't important enough
 > to fix in 2.0c1, although it seems good to fix for 2.0 final.

  And it's questionable how many bugs are hiding here as well.  I
count two:

  - test_import.py assumes the current directory is on the path; this
    is just plain fragile, and should explicitly pick the directory
    off of test_support.TESTFN, and add it to sys.path for the
    duration of the test (which does indeed fix this bug)

  - Modules/getpath.c interprets an empty definition of $PYTHONPATH as
    adding '' to sys.path, where I assert it should not add anything
    to sys.path.  Everywhere else I've recall seeing an environment
    variable used as a data source, the test is done like this:

    char *cp = getenv("VARIABLE");
    if (cp != NULL && cp[0] != '\0') {
        ...
    }

    (with some spelling variations).


  -Fred

-- 
Fred L. Drake, Jr.  <fdrake at beopen.com>
BeOpen PythonLabs Team Member