Metatest is a simple and elegant Python framework for writing tests.
Metatest is mostly about writing tests and by design is not tied to any particular test runner. Hence the name.
Here's how to write some tests using Metatest. We can think of the tests as an executable specification.
from metatest.py.mymod import plus, Point # Function plus adds two numbers. plus(2, 2) == 4 plus(2, '', _ex=TypeError) # Class Point represent a point in the plane. p = Point(2, 5) p.x == 2 p.y == 5 p.area == 10
And here's one way to run them.
if __name__ == '__main__': import metatest metatest.run()
It's not hard to write an adapter that will run these tests in a different test runner framework.
We gave a talk about Metatest at PyCon UK 2007 and here are the slides (HTML).
Please visit Sourceforge to
download Metatest.