[Zope-CMF] unit test weirdness.

Stefan H. Holek stefan@epy.co.at
Thu, 20 Feb 2003 16:34:31 +0100

You might want to check out my ZopeTestCase package.

While CMF support is currently weak (more to come RSN), it does all the 
dance with setting up the environment, properly (and quickly!) starting up 
Zope, and even handling INSTANCE_HOMEs. You may run your tests individually 
or as a suite (e.g. with testrunner).



--On Donnerstag, 20. Februar 2003 08:34 -0600 Mark McEahern 
<marklists@mceahern.com> wrote:

> [Tres Seaver]
>> Running individual unit tests as scripts is *not* the canonical way to
>> run in a Zope setup;  getting the dependencies right for all the Zope
>> machinery is too much to expect individual test writers to do, and to
>> get right.
> What are all the dependencies?  It seems like all I need to do is:
> 1.  Set PYTHONPATH; e.g.,
>     export PYTHONPATH='/usr/local/zope/lib/python'
> 2.  Import Zope correctly in a way that works with or without ZEO:
>     import Zope
>     Zope.startup()
> 3.  Copy my Zope product to $zope/Products; e.g.,
>     cp -R $myprod $zope/lib/python/Products
> 4.  Run my individual test; e.g.,
>     python2.1 $zope/lib/python/Products/$myprod/tests/$mytest.py
> This doesn't seem that hard or complicated to me.  And I don't see any
> alternatives for my own tests.  I'm writing a Product that will be used
> primarily in a CMF portal, but it should not depend on CMF.  Given that,
> how should I expect to run it?  Surely I can't expect to run it with
> all_cmf_tests.py.  And why should I expect to make it dependent on
> $zope/utilities/testrunner.py?

Those who write software only for pay should go hurt some other field.
/Erik Naggum/