-
Notifications
You must be signed in to change notification settings - Fork 87
Open
Description
Claudio,
Thank you very much for this comprehensive article, which I discovered from a recent Talk Python to Me podcast (362).
I was struck by the use of src layout, which I have seen before but did not understand. I immediately tried to adopt it for a
small project, but was struck that if I created a blank project with src layout, pytest was not working by default.
For example:
$ poetry new --name rnickle_template --src rnickle_template
$ ls
README.rst poetry.lock pyproject.toml src tests
$ pytest | grep ^E
E ModuleNotFoundError: No module named 'rnickle_template'
ERROR tests/test_rnickle_template.pyThere's an easy fix:
$ touch src/conftest.py
$ pytest
[ redacted ]
= 1 passed in 0.39s =Or in pytest >= 7:
[tool.pytest.ini_options]
pythonpath = [
"src"
]Perhaps we can add a comment about that to the setup page?
Thanks,
Rick
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels