PyTest fixtures are more modular, flexible, and reusable across a test suite. They can also be shared with other projects through the plugin system, making them highly versatile.
Hook functions allow plugins to modify PyTest's behavior, such as adding command-line flags or deselecting/skipping tests based on runtime factors.
There are at least 1,487 PyTest plugins listed on PyPI, identified by searching for projects that begin with 'pytest-' or 'pytest_'.
The Top PyTest Plugins list is based on the number of downloads over the past 30 days, currently featuring 133 plugins.
The most downloaded PyTest plugin is PyTestCov, which measures test coverage using Coverage.py and provides additional conveniences.
PyTest Metadata is used to add metadata to test reports, often in conjunction with PyTest HTML, and is one of the most popular plugins.
PyTest Playwright is a plugin for testing web applications using Playwright. It is notable for its utility in web projects and is on the speaker's list of plugins to explore.
PyTest MD Report generates test outcome reports in Markdown table format, making it useful for piping output to websites or other readable formats.
The top PyTest plugins include PyTestCov, PyTestMock, XDist, AsyncIO, Metadata, HTML, Timeout, RerunFailures, and PyTest Django.
Learning from plugin source code provides insights into advanced uses of fixtures and hook functions, which are often not fully covered in official documentation.
This episode kicks off a season of pytest plugins.
In this episode:
Links:
** Learn pytest**