[py-dev] PYTHONPATH not being honored

Sean Dawson sean.dawson at gmail.com
Thu Aug 11 15:37:13 CEST 2005


Hello,

I'm getting funky errors trying to set PYTHONPATH to override  
libraries.  Consider the following example:

$ cd sandbox
$ mkdir trac
$ touch trac/__init__.py
$ vim test_pypath.py

inside this file I just write:
---
import trac
print trac.__file__
assert 1==2
---

Note: I have a trac library installed in my site-packages directory.   
Running py.test in the sandbox directory gives the result I would  
expect, that is, it correctly imports the trac folder located in my  
sandbox dir.

However, I'm experiencing problems when I do the following:

$ mkdir blah
$ mv trac blah/trac
$ PYTHONPATH=blah py.test

In this case, however, the print statement tells me the trac library  
from my site-packages is getting loaded.  Any ideas?

I am running py.dist trunk

Thanks,
Sean



More information about the Pytest-dev mailing list