Improve 'module not found' message
See original GitHub issueIn #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 https://github.com/pytest-dev/pytest/issues/1567#issuecomment-1342649479_
Issue Analytics
- State:
- Created 9 months ago
- Comments:10 (4 by maintainers)
Top Results From Across the Web
Improve "Cannot find module" error · Issue #26588 - GitHub
While trying to debug an issue, I found the error message from node to be slightly misleading and/or not as useful as it...
Read more >How do I resolve "Cannot find module" error using Node.js?
it seems like when i installed it globally the npm/node-modules folder was empty and i was trying to use ng new project-name it...
Read more >How to Resolve MODULE NOT FOUND error in Python l Error ...
In this tutorial I will be showing you how to resolve the error message " Module Not Found ". This tutorial provides a...
Read more >How to fix "The following module is missing from the file ...
Restore the module and actually disable and uninstall it (recommended if possible): First, restore the module to its original location in the file...
Read more >ModuleNotFoundError: no module named Python Error [Fixed]
How to fix the ModuleNotFoundError in Python · 1. Make sure imported modules are installed · 2. Make sure modules are spelled correctly...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Our (for SageMath) main use of pytest would be to run doctests (in Python and in Cython). This can be done on per-file basis, in parallel (otherwise it takes many hours of wallclock time). But pytest makes it unnecessary hard to do things like
pytest foo/*/*– all thesemissing __init__.pyerrors. Currently we have a homemade tool which uses a bit of Python doctest module for this, but it’s old and tired, and we really want an off the shelf solution instead.No promises