Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'FAIL_FAST' flag to doctest #60726

Closed
bitdancer opened this issue Nov 21, 2012 · 6 comments
Closed

Add 'FAIL_FAST' flag to doctest #60726

bitdancer opened this issue Nov 21, 2012 · 6 comments
Assignees
Labels
easy type-feature A feature request or enhancement

Comments

@bitdancer
Copy link
Member

BPO 16522
Nosy @bitdancer, @durban
Files
  • doctest_fail_fast.patch
  • doctest_fail_fast_3.patch
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = 'https://github.com/bitdancer'
    closed_at = <Date 2012-11-21.20:11:08.228>
    created_at = <Date 2012-11-21.13:39:39.607>
    labels = ['easy', 'type-feature']
    title = "Add 'FAIL_FAST' flag to doctest"
    updated_at = <Date 2012-11-22.11:23:00.010>
    user = 'https://github.com/bitdancer'

    bugs.python.org fields:

    activity = <Date 2012-11-22.11:23:00.010>
    actor = 'python-dev'
    assignee = 'r.david.murray'
    closed = True
    closed_date = <Date 2012-11-21.20:11:08.228>
    closer = 'r.david.murray'
    components = []
    creation = <Date 2012-11-21.13:39:39.607>
    creator = 'r.david.murray'
    dependencies = []
    files = ['28063', '28067']
    hgrepos = []
    issue_num = 16522
    keywords = ['patch', 'easy']
    message_count = 6.0
    messages = ['176059', '176072', '176073', '176075', '176076', '176105']
    nosy_count = 3.0
    nosy_names = ['r.david.murray', 'daniel.urban', 'python-dev']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue16522'
    versions = ['Python 3.4']

    @bitdancer
    Copy link
    Member Author

    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).

    @bitdancer bitdancer self-assigned this Nov 21, 2012
    @bitdancer bitdancer added easy type-feature A feature request or enhancement labels Nov 21, 2012
    @durban
    Copy link
    Mannequin

    durban mannequin commented Nov 21, 2012

    I've added some tests and documentation. English is not my first language, so the docs almost certainly need some correction.

    @durban
    Copy link
    Mannequin

    durban mannequin commented Nov 21, 2012

    I'm sorry, I forgot the versionadded directive. The fixed patch is attached.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 21, 2012

    New changeset 966432a0734c by R David Murray in branch 'default':
    bpo-16522: Add FAIL_FAST flag to doctest.
    http://hg.python.org/cpython/rev/966432a0734c

    @bitdancer
    Copy link
    Member Author

    Looks great, I didn't think any changes were needed. Thanks a bunch, Daniel.

    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Nov 22, 2012

    New changeset e456da396ad9 by R David Murray in branch 'default':
    bpo-16522: s/always 1/at most 1/.
    http://hg.python.org/cpython/rev/e456da396ad9

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    easy type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant