classification
Title: Add 'FAIL_FAST' flag to doctest
Type: enhancement Stage: resolved
Components: Versions: Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: r.david.murray Nosy List: daniel.urban, python-dev, r.david.murray
Priority: normal Keywords: easy, patch

Created on 2012-11-21 13:39 by r.david.murray, last changed 2012-11-22 11:23 by python-dev. This issue is now closed.

Files
File name Uploaded Description Edit
doctest_fail_fast.patch r.david.murray, 2012-11-21 13:39 review
doctest_fail_fast_3.patch daniel.urban, 2012-11-21 18:54 review
Messages (6)
msg176059 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-11-21 13:39
When debugging using tests or doing test driven development, I find it very useful to have the test run exit immediately on the first failure.  Doctest currently has a feature to suppress all output after the first failure, but not to exit on the first failure.  Exiting on the first failure in doctest is even more important than in unit test for me, since a typical way to debug using doctest is to add prints to sys.stderr to the code.  If the doctest run continues, other tests that follow the same code path may also dump debugging output, making it harder to find the output related specifically to the test failure.

The attached patch does the easy part: adds a FAIL_FAST flag.  I don't have time right at the moment to finish the patch with docs and tests.  If someone wants to work on this before I get back to it they should feel free (just post a note here that you are working on it).
msg176072 - (view) Author: Daniel Urban (daniel.urban) * Date: 2012-11-21 18:49
I've added some tests and documentation. English is not my first language, so the docs almost certainly need some correction.
msg176073 - (view) Author: Daniel Urban (daniel.urban) * Date: 2012-11-21 18:54
I'm sorry, I forgot the versionadded directive. The fixed patch is attached.
msg176075 - (view) Author: Roundup Robot (python-dev) Date: 2012-11-21 20:09
New changeset 966432a0734c by R David Murray in branch 'default':
#16522: Add FAIL_FAST flag to doctest.
http://hg.python.org/cpython/rev/966432a0734c
msg176076 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2012-11-21 20:11
Looks great, I didn't think any changes were needed.  Thanks a bunch, Daniel.
msg176105 - (view) Author: Roundup Robot (python-dev) Date: 2012-11-22 11:22
New changeset e456da396ad9 by R David Murray in branch 'default':
#16522: s/always 1/at most 1/.
http://hg.python.org/cpython/rev/e456da396ad9
History
Date User Action Args
2012-11-22 11:23:00python-devsetmessages: + msg176105
2012-11-21 20:11:08r.david.murraysetstatus: open -> closed
resolution: fixed
messages: + msg176076

stage: needs patch -> resolved
2012-11-21 20:09:51python-devsetnosy: + python-dev
messages: + msg176075
2012-11-21 18:54:37daniel.urbansetfiles: + doctest_fail_fast_3.patch

messages: + msg176073
2012-11-21 18:53:51daniel.urbansetfiles: - doctest_fail_fast_2.patch
2012-11-21 18:49:26daniel.urbansetfiles: + doctest_fail_fast_2.patch
nosy: + daniel.urban
messages: + msg176072

2012-11-21 13:39:39r.david.murraycreate