[Zope-CMF] Testing a CMF site with PyUnit

Tres Seaver tseaver@zope.com
Fri, 9 Nov 2001 10:55:05 -0500 (EST)


On Fri, 9 Nov 2001, Chris Withers wrote:

> Tres,
>
> I'm hoping you've got a take on this one...
>
> Harry Wilkinson wrote:
> >
> > I am trying to use PyUnit to write tests for a CMF site.  Of
> > course, to do that I need to import Zope so I can do Zopeish
> > things with it.  I'm told by the all-knowing ChrisW that
> > messing around with sys.path to get it to import is
> > considered a bad idea and I'm not really sure what the
> > alternative is.
>
> I remember seeing stuff on the zope-coders list about tests
> that import sys.path being and futzing with it being 'bad'.
> However, if you do:
>
> python /whereever/testrunner.py -d mytestsdir
>
> ..you can't import Zope 'cos the it's living in
> /wherever/your_zope_base


  $ export ZOPE_HOME=/path/to/zope
  $ PYTHONPATH=$ZOPE_HOME/lib/python python \
    $ZOPE_HOME/utilities/testrunner.py -d mytestdir

The equivalent batch-file syntax is left as an exercise for the
Windows-bound student. :)

> So, what's the 'good' way of doing this now? Is testrunner
> still the offical Zope framework to be using?

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