[py-dev] Does each test method get called with a new instance?
Armin Rigo
arigo at tunes.org
Thu Apr 7 13:29:40 CEST 2005
Hi Holger,
On Tue, Apr 05, 2005 at 11:34:11PM +0200, holger krekel wrote:
> Not quite, instead of writing
>
> def __init__(self):
> ...
>
> you just write
>
> def setup_method(self, method):
> ...
I think the point of Roy was that in the second case the 'self' object
contains stuff left over by previous tests, which -- if you're not careful --
might interfere with this new test.
In general however what kind of automatic instantiation should occur for
TestXxx classes is just a matter of convention. Py's is not Unittest's and
both make some sense...
Armin
More information about the Pytest-dev
mailing list