Needed class whose instances are many test cases

Roy Smith roy at panix.com
Fri Nov 11 08:45:42 EST 2005


In article <dl24to$p20$1 at rose.polar.local>,
 Ben Finney <bignose+hates-spam at benfinney.id.au> wrote:

> This is a poor design; your tests will each be starting in a different
> state, and will likely not run the same way if run in a different
> order, making them fragile.
> 
> Test cases should each run individually, from a known state, and not
> depend on any other tests. You can define a fixture for several tests
> in the unittest.TestCase methods setUp() and tearDown(), to establish
> and clear up respectively for each test.

In general, I certainly agree with the above.  The problem is that 
sometimes setup is so expensive, it becomes impractical to do a full 
setup/teardown cycle for each test.



More information about the Python-list mailing list