$ pip install pytest
$ pytest --version # shows where pytest was imported from
$ pytest --fixtures # show available builtin function arguments
$ pytest -h | --help # show help on command line and config file options
If you want to know the default options, see pytest.ini
- Run all tests:
$ pytest
- Specifying tests / selecting tests:
# Run tests in a module $ pytest test_mod.py # Run tests in a directory $ pytest testing/
- Profiling test execution duration
$ pytest --durations=10
- Stopping after the first (or N) failures:
# stop after first failure $ pytest -x # stop after two failures $ pytest --maxfail=2
Detect program files which don't have test programs (test_....py
) in this directory.
$ python _generate_all_templates.py