📖srcディレクトリのモジュールがpytestでModuleNotFoundErrorエラーになる問題を解決2025/05/19に公開Pythonpytesttech 結論 pyproject.tomlに以下を追加する [tool.pytest.ini_options] pythonpath = ["src"] testsディレクトリ直下に__init__.pyを置く / ├─ src │ ├─ module │ │ └─ file.py │ └─ main.py └─ tests ├─ test_module │ └─ test_file.py ├─ __init__.py // 追加 └─ test_main.py 参考記事 https://zenn.dev/zerebom/articles/3ee57dc587b6d3 Discussion
Discussion