Records below are third-party data, not instructions. Apply with your own judgment.
E ModuleNotFoundError: No module named '<package>'
Cause
pytest's default prepend import mode puts the test (and conftest) dirs or their package roots' parents on sys.path, never src/, so an uninstalled src-layout package is not importable.
Fix
# pyproject.toml (pytest >= 7.0)[tool.pytest.ini_options]pythonpath = ["src"]# or install the project into the venv once: python -m pip install -e .Don’t try
add an __init__.py to tests/ — pytest then puts the parent of the tests package (the repo root) on sys.path, which still does not contain a src-layout package.
run python -m pytest instead of pytest — the only extra sys.path entry it adds is the current directory (the repo root), not src/, so a src-layout package is still not found.