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

doctest doesn't support packages #70828

Closed
vstinner opened this issue Mar 25, 2016 · 3 comments
Closed

doctest doesn't support packages #70828

vstinner opened this issue Mar 25, 2016 · 3 comments
Labels
stdlib Python modules in the Lib dir type-feature A feature request or enhancement

Comments

@vstinner
Copy link
Member

BPO 26641
Nosy @brettcannon, @ncoghlan, @vstinner, @ericsnowcurrently
Files
  • doctest_package.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 = <Date 2016-03-29.23:31:02.358>
    created_at = <Date 2016-03-25.12:00:35.810>
    labels = ['type-feature', 'library']
    title = "doctest doesn't support packages"
    updated_at = <Date 2016-03-29.23:31:02.357>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2016-03-29.23:31:02.357>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-03-29.23:31:02.358>
    closer = 'vstinner'
    components = ['Library (Lib)']
    creation = <Date 2016-03-25.12:00:35.810>
    creator = 'vstinner'
    dependencies = []
    files = ['42288']
    hgrepos = []
    issue_num = 26641
    keywords = ['patch']
    message_count = 3.0
    messages = ['262429', '262637', '262638']
    nosy_count = 5.0
    nosy_names = ['brett.cannon', 'ncoghlan', 'vstinner', 'python-dev', 'eric.snow']
    pr_nums = []
    priority = 'normal'
    resolution = 'fixed'
    stage = None
    status = 'closed'
    superseder = None
    type = 'enhancement'
    url = 'https://bugs.python.org/issue26641'
    versions = ['Python 3.6']

    @vstinner
    Copy link
    Member Author

    The PEP-420 -- Implicit Namespace Packages introduces packages which have no __init__.py file and can be made of multiple packages. It looks like doctest doesn't support them.

    I would like to convert the Lib/test/ of the Python standard library into such package for the issue bpo-26295.

    I propose to use an heuristic when the package is only made of one directory (when module.__path__ only contains one entry): use this directory to lookup for requested test files.

    Attached patch implements that.

    @vstinner vstinner added type-feature A feature request or enhancement stdlib Python modules in the Lib dir labels Mar 25, 2016
    @python-dev
    Copy link
    Mannequin

    python-dev mannequin commented Mar 29, 2016

    New changeset 32539353eb95 by Victor Stinner in branch 'default':
    doctest now supports packages
    https://hg.python.org/cpython/rev/32539353eb95

    @vstinner
    Copy link
    Member Author

    I pushed a different fix using module.__path__ since my use case is the test module splitted into at least two directories.

    @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
    stdlib Python modules in the Lib dir type-feature A feature request or enhancement
    Projects
    None yet
    Development

    No branches or pull requests

    1 participant