Issue 9857: SkipTest in tearDown is reported an as an error (original) (raw)

Created on 2010-09-14 21:45 by pitrou, last changed 2022-04-11 14:57 by admin. 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
2022-04-11 14:57:06 admin set github: 54066
2010-12-19 03:25:05 michael.foord set nosy:pitrou, draghuram, ezio.melotti, michael.foord, MarkRoddymessages: +
2010-12-19 03:24:16 michael.foord set status: open -> closednosy:pitrou, draghuram, ezio.melotti, michael.foord, MarkRoddymessages: + resolution: fixedstage: resolved
2010-11-09 10:45:26 ezio.melotti set nosy: + ezio.melotti
2010-11-07 00:39:46 MarkRoddy set files: + python27.skipteardown.patchmessages: +
2010-11-07 00:37:31 MarkRoddy set files: + python3k.skipteardown.patchnosy: + MarkRoddymessages: + keywords: + patch
2010-09-15 13:54:46 draghuram set nosy: + draghuram
2010-09-15 09:52:15 michael.foord set messages: +
2010-09-14 21:45:16 pitrou create