Random notes from mg

a blog by Marius Gedminas

Marius is a Python hacker. He works for Programmers of Vilnius, a small Python/Zope 3 startup. He has a personal home page at http://gedmin.as. His email is marius@gedmin.as. He does not like spam, but is not afraid of it.

Fri, 24 Sep 2004

Using the SchoolTool test runner to run Zope 3 tests

The SchoolTool test runner has a couple of features that the Zope 3 test runner does not have.

Here's how you can use it for a Zope 3 package called "ivija" (which happens to be a Zope 3 based application that I'm currently working on):

  1. Download test.py and save it as st-test.py. Place or symlink it into your Zope 3 root directory (~/Zope3 in my case).
  2. Create a shell script called test and put it wherever you want it (I keep it in ~/Zope3/src/ivija):
    #!/bin/sh
    ZOPE3_HOME=$HOME/Zope3
    TEST=$ZOPE3_HOME/st-test.py
    cd $ZOPE3_HOME
    python2.3 $TEST -wpv --search-in src/ivija "$@"
    
  3. When you want to run the tests, just run them as ./test [options].

Here's how long the Zope 3 test runner takes to walk through all subdirectories and find out which test modules need to be imported:

mg: ~/ivija$ time ./test.py nosuchtest
Configuration file found.
Running UNIT tests from /home/mg/Zope3
not a package src/ivija/reportgen/zLOG/tests
not a package src/ivija/reportgen/StructuredText/tests
No unit tests to be run.
Running FUNCTIONAL tests from /home/mg/Zope3
No functional tests to be run.

real    0m8.438s
user    0m7.050s
sys     0m1.290s

Here's how long the SchoolTool test runner takes to walk through just the ivija package subdirectories:

mg: ~/ivija$ time ./test nosuchtest
/home/mg/Zope3/src/ivija/reportgen/zLOG/tests is not a package
/home/mg/Zope3/src/ivija/reportgen/StructuredText/tests is not a package

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK

real    0m0.338s
user    0m0.200s
sys     0m0.010s

Not bad, huh?

Update: The SchoolTool test runner is no longer maintained. In the meantime the Zope 3 test runner gained a lot of features not present in the SchoolTool test runner.

posted at 19:30 | tags: | permanent link to this entry | 0 comments

Name (required)


E-mail (will not be shown)


URL


Comment (some HTML allowed)