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

unittest discovery process not working without .py source files #70668

Closed
stefanseefeld mannequin opened this issue Mar 4, 2016 · 4 comments
Closed

unittest discovery process not working without .py source files #70668

stefanseefeld mannequin opened this issue Mar 4, 2016 · 4 comments
Labels
stdlib Python modules in the Lib dir type-bug An unexpected behavior, bug, or error

Comments

@stefanseefeld
Copy link
Mannequin

stefanseefeld mannequin commented Mar 4, 2016

BPO 26481
Nosy @stefanseefeld, @rbtcollins, @ezio-melotti, @voidspace, @vadmium
Superseder
  • bpo-26859: unittest fails with "Start directory is not importable" when trying to run sourceless tests
  • 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-04-27.08:46:50.914>
    created_at = <Date 2016-03-04.17:09:32.478>
    labels = ['type-bug', 'library']
    title = 'unittest discovery process not working without .py source files'
    updated_at = <Date 2016-04-27.08:46:50.912>
    user = 'https://github.com/stefanseefeld'

    bugs.python.org fields:

    activity = <Date 2016-04-27.08:46:50.912>
    actor = 'martin.panter'
    assignee = 'none'
    closed = True
    closed_date = <Date 2016-04-27.08:46:50.914>
    closer = 'martin.panter'
    components = ['Library (Lib)']
    creation = <Date 2016-03-04.17:09:32.478>
    creator = 'stefan'
    dependencies = []
    files = []
    hgrepos = []
    issue_num = 26481
    keywords = []
    message_count = 4.0
    messages = ['261192', '261707', '261708', '264363']
    nosy_count = 5.0
    nosy_names = ['stefan', 'rbcollins', 'ezio.melotti', 'michael.foord', 'martin.panter']
    pr_nums = []
    priority = 'normal'
    resolution = 'duplicate'
    stage = 'test needed'
    status = 'closed'
    superseder = '26859'
    type = 'behavior'
    url = 'https://bugs.python.org/issue26481'
    versions = []

    @stefanseefeld
    Copy link
    Mannequin Author

    stefanseefeld mannequin commented Mar 4, 2016

    The unittest test discovery right now only looks into sub-packages if they contain a __init__.py file. That's an unnecessary requirement, as packages are also importable if only __init__.pyc is present.

    @stefanseefeld stefanseefeld mannequin added the stdlib Python modules in the Lib dir label Mar 4, 2016
    @rbtcollins
    Copy link
    Member

    Python has stopped supporting .pyc-only distributions - see https://www.python.org/dev/peps/pep-3147/#case-3-pycache-foo-magic-pyc-with-no-source - and so, while what you are seeing is inconsistent with import in some older python's, it is not a bug in newer Python's, and I don't see any benefit in doing a backport-only fix for it.

    @rbtcollins rbtcollins added invalid type-bug An unexpected behavior, bug, or error labels Mar 14, 2016
    @rbtcollins
    Copy link
    Member

    Sorry, I missed the little footnote on case 4 about still supporting source-less distributions. I guess in that context we do still need to support this.

    However - please check that this does indeed happen on Python master - 3.6. unittest does evolve and if you're testing on 2.7 or something your bug is perhaps already fixed.

    @rbtcollins rbtcollins reopened this Mar 14, 2016
    @vadmium
    Copy link
    Member

    vadmium commented Apr 27, 2016

    Please see bpo-26859; I think it is describing the same problem, and a fix is proposed (although no regression test)

    @vadmium vadmium closed this as completed Apr 27, 2016
    @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-bug An unexpected behavior, bug, or error
    Projects
    None yet
    Development

    No branches or pull requests

    2 participants