[Zope-CMF] unit test weirdness.

Mark McEahern marklists@mceahern.com
Thu, 20 Feb 2003 08:34:47 -0600


[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?

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

Thanks,

// mark

-