[Zope-CMF] unit test weirdness.
Tres Seaver
tseaver@zope.com
20 Feb 2003 10:46:38 -0500
On Thu, 2003-02-20 at 09:34, Mark McEahern 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
*That* is the evil part. $SOFTWARE_HOME/lib/python/Products should
*not* contain "third-party" products; those should be installed either
into $INSTANCE_HOME/Products or into a "shared" products directory
(using the PRODUCTS_PATH variable).
Otherwise you muddy what needs to be done to upgrade Zope itself.
> 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?
If you want to redistribute your product, you must not assume that it
will be installed into the SOFTWARE_HOME.
>
> I still have a feeling that I'm missing something. I apologize for being so
> dense. I appreciate your help.
>
> Fwiw, I filed this bug:
>
> http://collector.zope.org/CMF/131
I think we can update the tests to be compatible with 2.6.1, using the
'try: Zope.setup()' bit. We *won't* be updating them to remove the
'import Zope'.
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com