This is the most basic project layout for running pytest, a desirable test runner for your python code.
Then use pipenv to get your pytest dependencies.
cd my_project pipenv shell pipenv install pytest pytest-watch
Create project files
Then create your source file,
def placeholder(): return True
Then create your test file,
from module import placeholder def test_placeholder(): assert placeholder()
import will work by making the directory a package:
Run the tests
Now you should be ready to run tests.
pytest will run the tests once.
ptw will run the tests in watch mode.
That’s the simplest pytest setup I could conceive. Can you think of a simpler one? Of a better one?