Running Unit Tests

Running tests of individual packages

To run test of particular package, first checkout it:

svn co svn+ssh://user@svn.zope.org/repos/main/zope.component/trunk zope.component

Then, run bootstrap.py:

python2.4 bootstrap.py

and run buildout:

./bin/buildout

The directory is a buildout with testrunner recipe insatlled, so you can run tests:

./bin/test

To see the help options:

./bin/test --help

You can get the documentation for testrunner here : http://pypi.python.org/pypi/zope.testing

Running tests from trunk checkout

(Remember, all packages in Zope 3 are svn externals)

  • An easy way to run all unittests is the 'test.py' script in the top-level directory. Its usage message explains how to use this script to run only a selection of unittests. The advantage of this script is that it automatically takes care of setting PYTHONPATH; it also removes .pyc files for which no .py file exists.

  • Running individual unit tests should be simple.

    To run unit tests of a particular package use -s option:

    python test.py -s zope.interface
    

    To run unit tests of a particular module inside a package use -m option:

    python test.py -s zope.interface -m test_declarations
    
  • Running all unit tests in text mode:

    To run all tests:

    python test.py
    

    To run all unit tests:

    python test.py -u
    
  • Get an overview over all command line options for test.py:

    python test.py --help
    



( 98 subscribers )