[Pyunit-interest] unittest and __init__
Brought to you by:
purcell
From: Frank M. <fm...@qu...> - 2009-10-09 00:21:10
|
So I have a test suite and I would like to have a __init__ function so some things can be done one time instead of each each case like setUp() wants to do. I gather I can create a __init__ function, but that I must call the base class __init__ function . . . so far so good. However, so far I have found three conflicting documents: 1. Says using super() is the way to call the base class under unittest 2. Says calling TestCase.__init__ is the way to call the base class under unittest 3. One is a long dissertation of the evils of super() and how a class hierarchy can either call either base class functions explicitly or use super() but not to mix and match. Clearly one of the documents is wrong. The question is, which one? The bottom line is . . . does anyone have a working example of a __init__ function in a test suite? Something that is known to work in a supported way by PyUnit? Frank |