classification
Title: SkipTest in tearDown is reported an as an error
Type: behavior Stage: resolved
Components: Library (Lib) Versions: Python 3.2
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: MarkRoddy, draghuram, ezio.melotti, michael.foord, pitrou
Priority: normal Keywords: patch

Created on 2010-09-14 21:45 by pitrou, last changed 2010-12-19 03:25 by michael.foord. This issue is now closed.

Files
File name Uploaded Description Edit
python3k.skipteardown.patch MarkRoddy, 2010-11-07 00:37 Patch against the py3k branch to add support for handling SkipTest from the tearDown method review
python27.skipteardown.patch MarkRoddy, 2010-11-07 00:39 Patch against the release27-maint branch to add support for handling SkipTest from the tearDown method review
Messages (6)
msg116422 - (view) Author: Antoine Pitrou (pitrou) * (Python committer) Date: 2010-09-14 21:45
Raising SkipTest when in a tearDown method is reported as an error, rather than a skipped test.
Now doing this sounds like a weird use case, but it would be actually useful when you have a worker thread, and the tearDown method collects the exception raised in that thread and raises it again. For the worker thread to be able to use skipTest(), a SkipTest exception raised in tearDown should be properly reported as a skip.
msg116441 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-09-15 09:52
Interesting use case.

If the test has not yet failed this is fine. The problem is that if an exception has *already* been raised then it will already have been added to the result - so by then skipping is meaningless (or contradictory - the test can fail *and* skip).
msg120654 - (view) Author: Mark Roddy (MarkRoddy) * Date: 2010-11-07 00:37
Attaching patch which adds support for registering a skip when raised from tearDown.  Per Michael's point regarding failed tests, this is only handled if the test has been successful when SkipTest is raised from tearDown.
msg120655 - (view) Author: Mark Roddy (MarkRoddy) * Date: 2010-11-07 00:39
Attaching patch which does the same as the previous for the release27-maint branch.
msg124329 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-12-19 03:24
Committed revision 87390.

It is a stretch to see this as a bugfix rather than a new feature so probably *shouldn't* be backported to 2.7. On the other hand the fix is combined with the fix for issue 9857 which *is* a bugfix and *should* be backported to Python 2.7.
msg124330 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-12-19 03:25
Correction, the fix is combined with the fix for issue 10611.
History
Date User Action Args
2010-12-19 03:25:05michael.foordsetnosy: pitrou, draghuram, ezio.melotti, michael.foord, MarkRoddy
messages: + msg124330
2010-12-19 03:24:16michael.foordsetstatus: open -> closed
nosy: pitrou, draghuram, ezio.melotti, michael.foord, MarkRoddy
messages: + msg124329

resolution: fixed
stage: resolved
2010-11-09 10:45:26ezio.melottisetnosy: + ezio.melotti
2010-11-07 00:39:46MarkRoddysetfiles: + python27.skipteardown.patch

messages: + msg120655
2010-11-07 00:37:31MarkRoddysetfiles: + python3k.skipteardown.patch

nosy: + MarkRoddy
messages: + msg120654

keywords: + patch
2010-09-15 13:54:46draghuramsetnosy: + draghuram
2010-09-15 09:52:15michael.foordsetmessages: + msg116441
2010-09-14 21:45:16pitroucreate