[prev in list] [next in list] [prev in thread] [next in thread] 

List:       zope-dev
Subject:    [Zope-dev] explicit sys.path manipulation in test.py causing
From:       Rob Miller <ra () burningman ! com>
Date:       2008-09-10 18:29:46
Message-ID: ga93mq$iu8$1 () ger ! gmane ! org
[Download RAW message or body]

hi all,

in Zope's testrunner, the SOFTWARE_HOME is explicitly added to the front of
the python package lookup path, like so:

sys.path.insert(0, shome)

this doesn't happen in the same manner when you're actually starting a Zope
server.  as a result, the test runner will not work in certain environments
where Zope itself is purring happily along.

specifically, i've got a setup where Zope 2.10 is installed into a virtualenv
using the traditional Zope install mechanisms.  i want to use ZODB BLOB
storage, however, so i've got ZODB 3.8 eggs installed.  setuptools gives eggs
precedence over non-egg packages, so this works well, except when using
test.py, where the explicit insertion of SOFTWARE_HOME at the very
beginning of sys.path trumps the egg installation.

i'd like to put a check in there so that SOFTWARE_HOME is only added to the
package lookup if the Zope2 package isn't already available:

try:
     import Zope2
except ImportError:
     sys.path.insert(0, shome)

in other words, if the environment is already set up, don't mess with it.

anyone have a problem w/ me making this change on trunk and the 2.10 and 2.11 
branches?

-r

_______________________________________________
Zope-Dev maillist  -  Zope-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zope-dev
**  No cross posts or HTML encoding!  **
(Related lists - 
 http://mail.zope.org/mailman/listinfo/zope-announce
 http://mail.zope.org/mailman/listinfo/zope )
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic