A ten minute talk on pytest. With time for questions.
Audience: people who have done at least a small amount of Python coding. I do not expect you to have written tests or used testing tools.
You can test your Python code with pytest
,
one of the leading systems for testing Python code.
Here I will gently introduce you to pytest
with practical examples.
As pytest
themselves put it:
pytest: helps you write better programs
See https://docs.pytest.org/en/latest/
With conda
:
conda create --name pytest-talk pytest
With plain old virtualenv:
python -m venv pytest-demo
. pytest-demo/bin/activate
pip install pytest
In a project that has already been setup with some basic level of package management, you might find that it already has a system for installing dependencies and tools.
Testing increases confidence
(in your estimate of software quality).
pytest
makes testing systematic.
Can be incorporate into an automatic testing system, on every push. Can be used as a gated check for release: continuous integration.
pytest
unittest
, hypothesis
, doctest
, and the older nosetest
.
Also, may be embedded in a larger scope framework like tox
.