Example and template for a minimal project with pytest support.
pip install pytest
or conda install pytest
pip install pytest-cov
or conda install pytest
create file .coveragerc with following content:
[run]
omit = tests/*,*/__init__.py,*/test_*
pytest // runs all tests in all folders recursively
pytest -v // verbose output
pytest -k test_add // specific test
pytest tests // specific test package
pytest tests/test_calculator.py // specific test module
pytest --duration=3 // profiling of 3 slowest (test) functions
pytest --doctest-modules // run doctests
create file pytest.ini with following content to always run doctests
[pytest]
addopts = --doctest-modules
pytest --cov
pytest --cov=mymath
pytest --cov=mymath --cov-report html