[TIP] Handling exceptions while cleaning up in SuiteFixture Setup
Robert Collins
robertc at robertcollins.net
Mon Aug 31 13:02:16 PDT 2009
The general question here is 'how many outcomes is a test permitted to
have'.
We don't define it well enough to write correct TestResult objects from
the docstrings.
Currently, one can, without triggering assertions:
result.startTest(foo)
result.addError(foo, self._exc_info(Exception("whee")))
result.addSuccess(foo)
result.stopTest(foo)
I'm still mulling on this; but I think knowing that a test is running is
valuable [activity vs description], being clearer on outcomes is
valuable too.
For now, you could:
- addError
or
- stopTest(test)
- startTest(StubTestRepresentingSuite)
- adderror(STRS, error)
- stopTest(STRS)
The latter would be better I think, because it visible shows 'suite' vs
'last test in the suite'.
[Not to mention that Suite wide setup and teardown are a bad idea for
performance and isolation of tests, but thats a whole different troll]
-Rob
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : http://lists.idyll.org/pipermail/testing-in-python/attachments/20090901/a2a345a8/attachment.pgp
More information about the testing-in-python
mailing list