By default, Pytest checks all files matching its template.
select matching patterns
of test files and test functions with the
pytest -k ... option.
in a file to interactively debug in Spyder or other IDE.
Put default Pytest options in project “pyproject.toml”:
addopts = "-ra -v"
For Pytest to find and execute test scripts:
- each function name must begin with
def test_my1(a, b):
- each test file name must begin with
- each test file should be under a subdirectory somewhere in the project named
To run self-tests on a specific file from the command line: