Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

a micro test suite harness

Project Description
This is my own hacky micro test harness for Python unittests. It is currently
in use in a number of projects with large test cases. You might want to checkout
"nose" or "unittest2" first. :) Some features include:

- small, you can just put this one file in your "test" dir
- no external dependencies other than the stdlib
- tagging of individual and groups of tests to allow easily running test
subsets (can be very helpful in huge doc sets)
- support for "TestSkipped" as a return from a test (TODO: has modern added this now?). This is helpful for tests of platform-dependent
or optional features.

# Usage

A typical Python project setup (at least for me) is:

foo/ # project foo
lib/ # the main code of the project
test/ # the from *this project* # a small stub driver # an actual test file with TestCase's # another test file

Minimally the "" driver is:

import sys, os
import testlib
# Put the 'lib' dir on sys.path.
sys.path.insert(0, join(dirname(dirname(abspath(__file__))), "lib"))

Then you run:

cd test

The test harness will find all TestCase classes in all "test_*.py" files and
run them. Tagging support allows you to run subsets of the full test suite:

python foo # Just run tests in ""
python bar # ... just in ""

If "" looked something like this:

import unittest
from testlib import tag
class BlahTestCase(unittest.TestCase):
def test_whozit(self):
def test_whatzit(self):
def test_thatzit(self):

The then following would be possible:

python blah # run all tests in `BlahTestCase`
python question # run all tests tagged "question"
python -- -question # run all test *except* those tagged "question"
python whozit # run just `BlahTestCase.test_whozit`

See "Naming and Tagging" below for more details.

# Example Output


# Naming and Tagging


# Gathering from Multiple Test Directories


# Real-world examples

- [openkomodo]( the code for Komodo IDE and Edit
- [python-markdown2](
Release History

Release History

This version
History Node


History Node


Download Files

Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date (16.3 kB) Copy SHA256 Checksum SHA256 Source Jul 12, 2010

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting