Issue 16522: Add 'FAIL_FAST' flag to doctest (original) (raw)

Created on 2012-11-21 13:39 by r.david.murray, last changed 2022-04-11 14:57 by admin. 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) * (Python triager) 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) * (Python triager) 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) (Python triager) 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) (Python triager) 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
2022-04-11 14:57:38 admin set github: 60726
2012-11-22 11:23:00 python-dev set messages: +
2012-11-21 20:11:08 r.david.murray set status: open -> closedresolution: fixedmessages: + stage: needs patch -> resolved
2012-11-21 20:09:51 python-dev set nosy: + python-devmessages: +
2012-11-21 18:54:37 daniel.urban set files: + doctest_fail_fast_3.patchmessages: +
2012-11-21 18:53:51 daniel.urban set files: - doctest_fail_fast_2.patch
2012-11-21 18:49:26 daniel.urban set files: + doctest_fail_fast_2.patchnosy: + daniel.urbanmessages: +
2012-11-21 13:39:39 r.david.murray create