Hacker News new | ask | show | jobs
by josephorjoe 1794 days ago
I have seen way too many `ModuleNotFoundError`s. It is moderately infuriating when the two files are in the same directory and python can't find the module.

Honestly that error is misnamed. It should be `ModuleImportRefusedError`.

And the frustration caused by getting PyTest to work in a project is likely responsible for a large percentage of the untested python projects in the world...

1 comments

I’ve not had either of these issues. Maybe a detail left out?
the first occurs if you haven't created __init__.py.

the second occurs if you want your test files outside of the package directory (e.g., project/src/foo_app/foo.py, project/test/test_foo.py)