Zope 2.7, ZTC 0.8.6 When framework.py imports the Testing package, INSTANCE_HOME is overwritten. More precisely it happens in lib/python/Testing/__init__.py: ---------------------------------------------------- cfg = App.config.getConfiguration() # Set the INSTANCE_HOME to the Testing package directory cfg.instancehome = os.path.dirname(__file__) # Make sure this change is propogated to all the legacy locations for # this information. App.config.setConfiguration(cfg) ---------------------------------------------------- os.getenv("INSTANCE_HOME") will be <zope_installation>/lib/python/Testing after this, regardless of its original value. Is there any way to prevent ZTC and/or the Testing package from doing this? Regards, Sandor
zope@netchan.cotse.net wrote:
Is there any way to prevent ZTC and/or the Testing package from doing this?
Nope, just set the PRODUCTS_PATH environment variable to where your products really are... cheers, Chris -- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
I use the FileSystemSite product (http://www.zope.org/Members/k_vertigo/Products/FileSystemSite) to serve some static pages for the management pages of my product. If your static content folder is under INSTANCE_HOME, FSS trims this prefix from the path (http://cvs.infrae.com/FileSystemSite/utils.py?rev=1.1&content-type=text /vnd.viewcvs-markup - minimalpath method). This means that the path you have to pass to createDirectoryView depends on if your INSTANCE_HOME points to the home of your product or not. A workaround for this is to check if INSTANCE_HOME really points to your instance and set the filepath argument of createDirectoryView (http://cvs.infrae.com/FileSystemSite/DirectoryView.py?rev=1.5&content-t ype=text/vnd.viewcvs-markup) accrodingly, however this is a hack and I hate hacks ;-) Regards, Sandor
-----Original Message----- From: Chris Withers [mailto:lists@simplistix.co.uk] Sent: Friday, March 05, 2004 4:56 AM To: zope@netchan.cotse.net Cc: zope@zope.org Subject: Re: [Zope] ZopeTestCase and INSTANCE_HOME
zope@netchan.cotse.net wrote:
Is there any way to prevent ZTC and/or the Testing package from doing this?
Nope, just set the PRODUCTS_PATH environment variable to where your products really are...
cheers,
Chris
-- Simplistix - Content Management, Zope & Python Consulting - http://www.simplistix.co.uk
Sandor, This is no longer a problem with CMF 1.4 DirectoryViews, so I assume FileSystemSite has not been updated yet. Anyway, the changing of INSTANCE_HOME is an artefact of importing the Testing package. There are ways to work around it though. Here's how I do it (see class TestImportExport): <http://cvs.sourceforge.net/viewcvs.py/collective/ZopeTestCase/testZODBComp at.py?rev=1.14&view=auto> Still, the IMO better solution is to update FSS or have a look at Standalone Skins: <http://www.plope.org/Members/chrism/standalone_skins> HTH, Stefan --On Freitag, 05. März 2004 15:14 -0600 zope@netchan.cotse.net wrote:
I use the FileSystemSite product (http://www.zope.org/Members/k_vertigo/Products/FileSystemSite) to serve some static pages for the management pages of my product. If your static content folder is under INSTANCE_HOME, FSS trims this prefix from the path (http://cvs.infrae.com/FileSystemSite/utils.py?rev=1.1&content-type=text /vnd.viewcvs-markup - minimalpath method). This means that the path you have to pass to createDirectoryView depends on if your INSTANCE_HOME points to the home of your product or not. A workaround for this is to check if INSTANCE_HOME really points to your instance and set the filepath argument of createDirectoryView (http://cvs.infrae.com/FileSystemSite/DirectoryView.py?rev=1.5&content-t ype=text/vnd.viewcvs-markup) accrodingly, however this is a hack and I hate hacks ;-)
Regards, Sandor
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
This is no longer a problem with CMF 1.4 DirectoryViews, so I assume FileSystemSite has not been updated yet.
They did, it's in their cvs, but there is no release with these updates. The sources are published via ViewCVS, but I couldn't find out how to grab these with anonymous cvs. Anyone?
Anyway, the changing of INSTANCE_HOME is an artefact of importing the Testing package. There are ways to work around it though. Here's how I do [...]
Thanks, this helped. I had to move the import statements into a method body because FSS sets its internal instance home variable during import time, before afterSetup fixes the environment, but that's all. Regards, Sandor
If what you want is test products in INSTANCE_HOMEs there is a testrunner with INSTANCE_HOME support at <http://zope.org/Members/shh/TestRunner> Stefan --On Donnerstag, 04. März 2004 14:25 -0600 zope@netchan.cotse.net wrote:
Is there any way to prevent ZTC and/or the Testing package from doing this?
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
All my tests (70k+ python source) are written for ZopeTestCase, it's not an option to switch. Regards, Sandor
-----Original Message----- From: Stefan H. Holek [mailto:stefan@epy.co.at] Sent: Friday, March 05, 2004 6:46 AM To: zope@netchan.cotse.net Cc: zope@zope.org Subject: Re: [Zope] ZopeTestCase and INSTANCE_HOME
If what you want is test products in INSTANCE_HOMEs there is a testrunner with INSTANCE_HOME support at <http://zope.org/Members/shh/TestRunner>
Stefan
--On Donnerstag, 04. März 2004 14:25 -0600 zope@netchan.cotse.net wrote:
Is there any way to prevent ZTC and/or the Testing package from doing this?
-- The time has come to start talking about whether the emperor is as well dressed as we are supposed to think he is. /Pete McBreen/
participants (3)
-
Chris Withers -
Stefan H. Holek -
zope@netchan.cotse.net