[TIP] Reusable test suites in nose

Michael Williamson mike at zwobble.org
Mon Jan 7 03:58:05 PST 2013


When writing different implementations of the same interface, it's
useful to be able to run the same test suite against each different
implementation. I've quickly knocked up a bit of code to do just that
with nose -- is there something similar that already exists elsewhere?

The way it works is:

There's a class called TestSuiteBuilder, which collects up all the


You then define your tests, which accept some number of arguments. The
idea is that the exact implementation of those arguments is what will
vary. In this case, I'm testing a general interface for a virtual
machine provider.


Then, you instantiate a test class with a specific implementation using
the "create" method:



More information about the testing-in-python mailing list