[TIP] setup/teardown with multiple python modules

Robert Collins robertc at robertcollins.net
Sun May 20 16:24:14 PDT 2012

On Mon, May 21, 2012 at 10:38 AM, Maciej Dziardziel <fiedzia at gmail.com> wrote:
> I have rather broad question about proper way of providing
> functionality for writing functional tests by python package authors.
> I am writing application which uses package A and package B, for
> accessing two type of databases.
> Both of those provide its own TestCase inheriting from
> unittest.TestCase, to perform setup and teardown.
> In order to create functional test that accesses both databases, i can either:

So the basic problem there is that overloading TestCase (logically
grouped tests) with fixtures and support code for some specific
environment is a mistake.

Hopefully A and B provide non-TestCase versions of their support code,
and you can then use something like fixtures, perhaps in combination
with testscenarios, to let you write your tests and inject the
appropriate database support code.

I've blogged about the general problem, and the solutions I've come up
with: Hope it helps.



More information about the testing-in-python mailing list