[Zope-Coders] Testing from an INSTANCE_HOME

Stefan H. Holek stefan@epy.co.at
Mon, 9 Jun 2003 20:04:46 +0200


On Samstag, Jun 7, 2003, at 16:38 Europe/Vienna, Chris Withers wrote:

> Stefan H. Holek wrote:
>> The goal of having Testing not touch INSTANCE_HOME can be achieved 
>> without changing the "interface" of the Testing package (something I 
>> am not overly happy with, think backward compatibility).
>
> How so?

I have shipped tests to customers. I have no way of "upgrading" those 
tests after the fact.

>> Simply have Testing communicate the directory to Zope.App.startup() 
>> by other means, say, an environment variable named TESTING_HOME. I 
>> have tried this already and could provide code.
>
> Please! Not another environment variable :-(

Well, this one would be secret of course ;-).

In Zope 2.7 we will be able to use ZConfig and the like, but not yet.

>> It allows for great flexibility when writing integration and 
>> regression tests. I can choose to run my tests against a 
>> preconfigured ZODB (and even a ZEO server) simply by providing a 
>> custom custom_zodb.py. I'd rather not lose that capability.
>
> Well, I would imagine the Testing.app() thing would have a similar 
> hook for you to replace the database it uses for testing...

Would this then make Testing simpler or just different?

Allright. Zope 2.7 will change the landscape anyway by introducing 
ZConfig. We will have better options then (no pun intended). The 
zope.conf file will contain the instance home directory (tadah!).

In Zope 2.7 the testrunner could learn a new command line switch: -C 
configfile
(I have to thank Shane for gently pushing me towards this idea)

We could then run tests like so:

   python /Zope/utilities/testrunner.py -qd . -C /home/zope/etc/zope.conf

This seems pretty neat and dobale with little changes to Testing, 
App.FindHomes, and Zope.App.startup.

For Zope 2.6 I see two options:

- Defer to 2.7
- Stop Testing from changing INSTANCE_HOME so people can at least run 
tests
   after setting the INSTANCE_HOME environment variable. Note that you 
can
   already do this with ZopeTestCase.

Comments?

Stefan


--
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/