This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: StopTestRun exception to halt test run
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: michael.foord Nosy List: Pam.McANulty, berker.peksag, kushal.das, michael.foord, r.david.murray
Priority: normal Keywords: patch

Created on 2010-12-03 02:09 by michael.foord, last changed 2022-04-11 14:57 by admin.

Files
File name Uploaded Description Edit
cpython-10612-StopTestRun.patch Pam.McANulty, 2015-04-13 16:07 Version 1 of the patch review
cpython-10612-StopTestRun-v2.patch Pam.McANulty, 2015-04-13 16:53 Version 2 of the patch review
Messages (5)
msg123158 - (view) Author: Michael Foord (michael.foord) * (Python committer) Date: 2010-12-03 02:09
It is hard for test infrastructure to halt a test run unless it has access to the result object. 

A StopTestRun exception could be provided. This could be caught in TestCase.run and call TestResult.stop().

It could be parameterized so that StopTestRun(report=False) bombs out and stops the test run completely.
msg220818 - (view) Author: Mark Lawrence (BreamoreBoy) * Date: 2014-06-17 12:47
Slipped under the radar?
msg240640 - (view) Author: Pam McA'Nulty (Pam.McANulty) * Date: 2015-04-13 16:07
Added unittest.StopTestRun exception.  It's caught and handled in testPartExecutor() - which is the same place SkipTest is caught.

If report=False, then it sets the result.haltTestRun attribute, which is a signal to TestTextRunner to not generate any output.

Added notes to whatsnew and unittest docs
msg240659 - (view) Author: Pam McA'Nulty (Pam.McANulty) * Date: 2015-04-13 16:53
This version fixes a few things after using review.

I still have some open questions:

o Where in unittest.rst should the StopTestRun documentation actually live?
  I've put it right after the SkipTest exception.  That doesn't feel perfect, but I didn't see a place where it would fit any better.

o What should the flag structure be?
  I've implemented it with two flags on the Outcome object which lead to an optional flag on the result object.  It works, but it's a bit messy


o What word should "haltTestRun" really be?    
  I've chosen the word "halt" to represent the "halt-reporting" flag.  I think my firmware background is showing.  Any suggestions for a better term?
msg240807 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2015-04-13 23:36
I've added some review comments.  I did not download the patch and run the tests etc; it would be great if you could find another sprinter (or anyone :) to do that level of review.
History
Date User Action Args
2022-04-11 14:57:09adminsetgithub: 54821
2019-03-15 22:09:24BreamoreBoysetnosy: - BreamoreBoy
2015-04-13 23:36:42r.david.murraysetmessages: + msg240807
2015-04-13 19:56:58berker.peksagsetnosy: + berker.peksag
stage: patch review
type: performance -> enhancement

versions: + Python 3.5, - Python 3.2, Python 3.3
2015-04-13 16:55:29Pam.McANultysetnosy: + kushal.das
2015-04-13 16:54:13Pam.McANultysetnosy: + r.david.murray
2015-04-13 16:53:04Pam.McANultysetfiles: + cpython-10612-StopTestRun-v2.patch

messages: + msg240659
2015-04-13 16:07:01Pam.McANultysetfiles: + cpython-10612-StopTestRun.patch
keywords: + patch
messages: + msg240640
2015-04-13 14:56:01Pam.McANultysetnosy: + Pam.McANulty
2014-06-17 12:47:54BreamoreBoysetnosy: + BreamoreBoy
messages: + msg220818
2010-12-03 02:09:28michael.foordcreate