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

Allow passing DocTestRunner and DocTestCase in doctest #43657

Open
freakboy mannequin opened this issue Jul 12, 2006 · 9 comments
Open

Allow passing DocTestRunner and DocTestCase in doctest #43657

freakboy mannequin opened this issue Jul 12, 2006 · 9 comments
Labels
3.13 bugs and security fixes easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@freakboy
Copy link
Mannequin

freakboy mannequin commented Jul 12, 2006

BPO 1521051
Nosy @asvetlov, @freakboy3742, @cjerdonek, @MaxwellDupre
Files
  • doctest-configuration.diff: Patch to allow extra customization of DocTestSuite
  • doctest-configuration-1.diff
  • test.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 = None
    closed_at = None
    created_at = <Date 2006-07-12.08:47:04.000>
    labels = ['easy', 'type-feature', 'library']
    title = 'Allow passing DocTestRunner and DocTestCase in doctest'
    updated_at = <Date 2022-01-21.17:35:46.293>
    user = 'https://bugs.python.org/freakboy'

    bugs.python.org fields:

    activity = <Date 2022-01-21.17:35:46.293>
    actor = 'mikecmcleod'
    assignee = 'none'
    closed = False
    closed_date = None
    closer = None
    components = ['Library (Lib)']
    creation = <Date 2006-07-12.08:47:04.000>
    creator = 'freakboy'
    dependencies = []
    files = ['7393', '29714', '31059']
    hgrepos = []
    issue_num = 1521051
    keywords = ['patch', 'easy']
    message_count = 9.0
    messages = ['50676', '50677', '116170', '116222', '170529', '186204', '186577', '193803', '411160']
    nosy_count = 8.0
    nosy_names = ['collinwinter', 'freakboy', 'asvetlov', 'freakboy3742', 'chris.jerdonek', 'Kostyantyn.Leschenko', 'jasonamyers', 'mikecmcleod']
    pr_nums = []
    priority = 'normal'
    resolution = None
    stage = 'test needed'
    status = 'open'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue1521051'
    versions = ['Python 3.4']

    @freakboy
    Copy link
    Mannequin Author

    freakboy mannequin commented Jul 12, 2006

    DocTestRunner can be modified by end users to override
    default testing behaviour when executing doctests.

    Similarly, DocTestCase can be extended to override
    default setup/teardown behaviour.

    However, when a DocTestSuite is used to discover
    doctests, it is not possible to specify a user-modified
    Runner or TestCase.

    This patch (against svn revision 46884 of
    Lib/doctest.py) enables end users to specify the class
    that is used to construct DocTest test cases, and the
    runner that is used to run DocTest test cases.

    By default, DocTestSuite will continue to instantiate
    DocTestRunner and DocTestCase instances as before.

    @freakboy freakboy mannequin added stdlib Python modules in the Lib dir labels Jul 12, 2006
    @collinwinter
    Copy link
    Mannequin

    collinwinter mannequin commented Mar 7, 2007

    This looks good to me. Could you add some tests (to Lib/test/test_doctest.py) and update the docs (Doc/lib/libdoctest.tex)?

    Thanks for your contribution!

    @devdanzin devdanzin mannequin added easy type-feature A feature request or enhancement labels Mar 30, 2009
    @BreamoreBoy
    Copy link
    Mannequin

    BreamoreBoy mannequin commented Sep 12, 2010

    The patch appears to be way out of date. Is there any interest in the concept of this patch, has something similar already been done or what?

    @freakboy3742
    Copy link
    Mannequin

    freakboy3742 mannequin commented Sep 12, 2010

    It's still a problem AFAICT. Level of interest is a different matter.

    Django has needed this since 2006, so we've always shipped a locally modified copy of the doctest module.

    That said, Django is in the process of moving away from using and recommending doctests, so there's a good chance that we'll be deprecating our local copy in the near future.

    There's still value in the idea -- it provides configuration points that are consistent and reasonable -- but Django's need for this set of changes is waning.

    @cjerdonek
    Copy link
    Member

    I think this would be useful as well. For example, it would let one more easily get finer-grained test result data (e.g. to the level of doctest examples rather than just the TestCase level). Without this, I needed to monkey patch.

    The previously attached patch enhances DocTestSuite. I think DocFileSuite should receive the same treatment (the case I was more interested in myself -- cf. http://bugs.python.org/issue15629#msg170447 ).

    @cjerdonek cjerdonek changed the title Extra configurability for doctest TestCases Allow passing DocTestRunner and DocTestCase in doctest Sep 15, 2012
    @cjerdonek cjerdonek changed the title Extra configurability for doctest TestCases Allow passing DocTestRunner and DocTestCase in doctest Sep 15, 2012
    @KostyantynLeschenko
    Copy link
    Mannequin

    KostyantynLeschenko mannequin commented Apr 7, 2013

    I've updated patch to work with current trunk and added new params to doctest documentation.

    @asvetlov
    Copy link
    Contributor

    I like the patch but please add tests also.
    We need to put new behavior in stone :)
    Take a look on comments to the patch also.

    @jasonamyers
    Copy link
    Mannequin

    jasonamyers mannequin commented Jul 28, 2013

    The attached file contains a simple test for this code to make sure the test runner is being applied. I've never submitted anything before, so it might be totally naive.

    @MaxwellDupre
    Copy link
    Mannequin

    MaxwellDupre mannequin commented Jan 21, 2022

    I would like to help on this issue.

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    @iritkatriel iritkatriel added the 3.12 bugs and security fixes label Oct 5, 2022
    @erlend-aasland erlend-aasland added 3.13 bugs and security fixes and removed 3.12 bugs and security fixes labels Jan 5, 2024
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.13 bugs and security fixes easy stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    Status: No status
    Development

    No branches or pull requests

    4 participants