Pytest is extensible and has plenty of plugins. You don’t need to use any of them, but you might find some very useful. I love this because you have an easy time to get started with unit testing, while still finding amazing stuff when you’re more experienced 🤩
In this article, I’ll show you examples of plugins I use and the plugins I found while writing this article. You might want to cover the basics of unit testing first or refresh testing details like fixtures.
All plugins presented in this article can be installed via pip
. Most of them are then already active. For example, when you install pytest-sugar via
pip install pytest-sugar
You can just execute pytest
and the plugin will automatically work. Others need to be used more directly. For example, after installing pytest-timeout
you need to specify the timeout parameter you want to use:
pytest --timeout=1
Don’t worry, I will explain those two plugins later 🙂
Searching on pypi.org for the trove classifier Framework :: Pytest
, I found 668 packages. A stunning 1053 packages have “pytest” in the name. 461 packages have both, the name and the trove classifier.
#programming #software-development #unit-testing #python #software-engineering