[ZODB-Dev] RE: RE: PersistentMapping

Tim Peters tim at zope.com
Wed Nov 23 23:17:47 EST 2005


[Julien]
>>> I need to try that again but, if I remember correctly, without the
>>> PYTHONPATH update it didn't work out for me.

[Tim]
>> Works for me ;-)  A possible difference is that you stuffed ZODB/src at
>> the front of PYTHONPATH, but test.py appends ZODB/src to the end of
>> sys.path. If you have other ZODB or Zope code on sys.path (I never do
>> when I run ZODB tests), your way might be effective at "hiding" the
>> installed code from ZODB's test.py.  I'm not sure.
>>
>> Please figure out whether that's the case in the way you run this stuff.
>> If it is, ZODB's test.py could be changed to "prepend" ZODB/src instead.

[Julien]
> Still doesn't work.

AFAICT, everything you said after his demonstrated that "prepending" (as
opposed to appending) the path _did_ work for you.  So I'll assume this is
just miscommunication.

> Here is the exact set of commands :
>
> [anguenot at dhcp-401-3751 tmp]$ echo $PYTHONPATH
>
> [anguenot at dhcp-401-3751 tmp]$ svn co
svn+ssh://anguenot@svn.zope.org/repos/main/ZODB/trunk/ ZODB
>
> [...]
>
> Checked out external at revision 40348.
>
> Checked out revision 40348.
> [anguenot at dhcp-401-3751 tmp]$ cd ZODB/
> [anguenot at dhcp-401-3751 ZODB]$ python setup.py build_ext -i
>
> [...]
>
> [anguenot at dhcp-401-3751 ZODB]$ python test.py -v
> Running tests from src
> Traceback (most recent call last):
>   File "test.py", line 40, in ?
>     from zope.testing import testrunner
> ImportError: cannot import name testrunner [anguenot at dhcp-401-3751 ZODB]$
>
> Then if I'm adding the src dir within the PYTHONPATH it works :
>
> [anguenot at dhcp-401-3751 ZODB]$ export PYTHONPATH=`pwd`/src

And this (effectively) prepends src/ to sys.path.

> [anguenot at dhcp-401-3751 ZODB]$ echo $PYTHONPATH
> /tmp/ZODB/src
> [anguenot at dhcp-401-3751 ZODB]$ python test.py -v Running tests from src
> Running tests at level 1
>
> [...]
>
> I found the problem on my box. Twisted is installed on my Python version
> and twisted requires zope.interface form Zope3 and this last was thus
> installed on test Python I'm using to launch the ZODB tests.
>
> within test.py the sys.path insertion looked like this one :
>
> sys.path.append(src)

Yes, that's what my "test.py appends ZODB/src to the end of sys.path" meant.

> and then while looking for zope.testing.testrunner it couldn't be found
> since the zope.interface doesn't include it.
>
> I changed the test.py like below so that it append the src path first in
> the list of dir the interpretor should look at.
>
> sys.path.insert(0, path)

While that's what my "ZODB's test.py could be changed to "prepend" ZODB/src
instead" meant ;-)

> Checked in in rev [40349]

Fine by me!  Thanks.



More information about the ZODB-Dev mailing list