[Zope-dev] Re: running test.py with instance_home products.

Tres Seaver tseaver at zope.com
Tue Mar 2 10:52:21 EST 2004


Chris Withers wrote:
> Chris McDonough wrote:
> 
>> Has anyone found a reasonable strategy for using Zope's test.py to test
>> products that are installed outside the Zope software home?  I try
>> running it from the software home and using the --dir option to point it
>> to where my product is, but it tells me it can't find any tests.
> 
> 
> I think I run test.py (or somethign similar) from a shell script in 
> which I set the PRODUCTS_PATH environment variable, as well as 
> INSTACNE_HOME and SOFTWARE_HOME.
> 
> How shoudl I be looking to do that in Zope 2.7? ;-)

test.py needs to grow a --config-file option;  if passed in, it should 
do the Zope.startup() dance with the passed file, e.g.::

------------------------------- 8< ----------------------------------
import Zope
import App.config
from Zope.Startup import handlers, options

def installConfigFileForTesting(config_file)
     opts = options.ZopeOptions()
     opts.realize(args=('-C', config_file))
     handlers.handleConfig(opts.configroot, opts.confighandlers)
     App.config.setConfiguration(opts.configroot)
     Zope.startup()
------------------------------- 8< ----------------------------------


Tres.
-- 
===============================================================
Tres Seaver                                tseaver at zope.com
Zope Corporation      "Zope Dealers"       http://www.zope.com




More information about the Zope-Dev mailing list