[Zope-Coders] Testing
Tres Seaver
tseaver@zope.com
Tue, 9 Oct 2001 00:37:43 -0400 (EDT)
On Tue, 9 Oct 2001, Chris Withers wrote:
> Chris McDonough wrote:
> >
> > > where's zctl.py nowdays? does it come with documentation?
> > > Is the process for running the Zope tests the same or
> > > should I use testrunner.py?
> >
> > This is a good question. For now, I'd pick an existing test
> > module and ape its structure.
>
> Can anyone recommend a good one to copy in the CMF?
>
> (and one in the Zope core?)
>
> Also, what's the best way to run _all_ the CMF tests and/or all
> the Zope tests? (since this _should_ be done before any kindof
> merge to a releasable branch ;-)
We've been using a script built around the 'zctl' utility; since
it is not "officially blessed", I have just checked in a
mega-suite module, 'all_cmf_tests', into the root of the CMF
package.
$ cd ~/projects/CMF
$ cvs -q status all_cmf_tests.py
===================================================================
File: all_cmf_tests.py Status: Up-to-date
Working revision: 1.1
Repository revision: 1.1 /cvs-repository/Releases/CMF/all_cmf_tests.py,v
Sticky Tag: (none)
Sticky Date: (none)
Sticky Options: (none)
Here is what it looks like, running in a Zope 2.3 sandbox with
zctl:
$ cd ~projects/cmf_test
$ ln -s ../CMF/all_cmf_tests.py
$ ./zctl.py test all_cmf_tests.py
ZEO server ready.
..................................................................\
...........................
Time: 28.039s
OK (93 tests)
Here is what it looks like, running in a Zope 2.4 sandbox with
no zctl ('ztest' is a script which uses the testrunner from
$ZOPE_HOME/utilities):
$ cd ~/projects/no_zctl
$ ln -s ../CMF/all_cmf_tests.py
$ cat ztest
#! /bin/sh
ZOPE_HOME=/usr/local/zope/Zope-2.4-head
reldir=`dirname $0`
INSTANCE_HOME=`cd $reldir; pwd`
SOFTWARE_HOME=$ZOPE_HOME/lib/python
export INSTANCE_HOME SOFTWARE_HOME
cd $SOFTWARE_HOME && \
exec /usr/local/bin/python2.1 $ZOPE_HOME/utilities/testrunner.py -q $@
$ ./ztest -f `pwd`/all_cmf_tests.py
Running: /home/tseaver/projects/no_zctl/all_cmf_tests.py
.....................................................................\
...........................
----------------------------------------------------------------------
Ran 96 tests in 21.400s
OK
Tres.
--
===============================================================
Tres Seaver tseaver@zope.com
Zope Corporation "Zope Dealers" http://www.zope.com