February 2022
Intermediate to advanced
274 pages
6h 28m
English
We’ll start by making changes in a conftest.py file and testing our changes locally before moving the code to a plugin.
To modify how pytest works, we need to utilize pytest hook functions. Hook functions[56] are function entry points that pytest provides to allow plugin developers to intercept pytest behavior at certain points and make changes. The pytest documentation lists a lot of hook functions.[57] We’ll use three in this chapter:
pytest_configure()—Allows plugins and conftest files to perform initial configuration. We’ll use this hook function to pre-declare the slow marker so users don’t have to add slow to their config files.
pytest_addoption()—Used to register options and settings. We’ll add the ...
Read now
Unlock full access