[issue24249] unittest API for detecting test failure in cleanup/teardown

Robert Collins report at bugs.python.org
Tue Jul 14 01:31:45 CEST 2015


Robert Collins added the comment:

Setting some basic design parameters here.

Its ok for a test to know if it itself has decided on some status. See e.g. testtools.expectThat for a related design thing.

Making some official API within the test itself so code after the failure can take appropriate actions seems pretty safe to me, as long as its a one-way switch - no backsies.

I think inspecting the reporter would be overly limiting on the reporter implementation, and we shouldn't do that.

Further, I think limiting the possible status's that we track to the minimum would be good here, even though its inconsistent with the current overly rich separation unittest offers.

That is, some self.status field which might even be an enum (if enum34 supports Python 2.6 for backports [as unittest is currently backported to 2.6 and up].

unset
success
unexpected success
skipped
failed
expected failure

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24249>
_______________________________________


More information about the Python-bugs-list mailing list