[Zope3-dev] test.py renamed

Jim Fulton jim at zope.com
Mon Oct 10 08:40:26 EDT 2005


Martijn Faassen wrote:
> Jim Fulton wrote:
> 
>> A better change would be to arrange for the root directory to be excluded
>> from the Python path. In general, any script we use should, by default,
>> exclude its directory from sys.path.
> 
> 
> Maybe this only turns up if you have a package layout where the 
> __init__.py is in the same place as the test runner?

No.  In fact, in this case, the problem had nothing to do
with relative package imports and everything to do with the
fact that there were 2 top-level "test" modules/packages
on the Python path, Zope's test runner, and Python's test
package.  This only occurs because, by default, when Python
runs a script, it adds the directory including the script to
the Python path. That policy is often convenient, but it isn't
convenient for Zope.

Jim

-- 
Jim Fulton           mailto:jim at zope.com       Python Powered!
CTO                  (540) 361-1714            http://www.python.org
Zope Corporation     http://www.zope.com       http://www.zope.org


More information about the Zope3-dev mailing list