Skip to content

Improve 'module not found' message #10569

Open
@nicoddemus

Description

@nicoddemus

In #1567 it was men, user has spent a long time trying to figure out why their namespace package was not being found, reason being that pytest does not support namespace packages via --pyargs (#478).

One easy suggestion is to improve the error message, from:

ERROR: module or package not found: module.misc (missing __init__.py?)

To something like this:

ERROR: pytest cannot import module or package 'module.misc'
Possible reasons:
- Missing an __init__.py file
- Namespace package (not supported)
- Not reachable via PYTHONPATH
See <link to docs> for more information.

Bonus points if we link to a documentation where we have an explanation for each bullet point above.

Originally posted by @nicoddemus in #1567 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: docsdocumentation improvement, missing or needing clarification

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions