Description
What's the problem this feature will solve?
I would like to provide a default configuration for how things are set up, so each project using Pytest in my company does not need to provide some default configurations to use the tools we are developing.
This means providing default configurations to plugin's parameters.
In most cases this is already configured fine, but in case of depending on other utilities like pytest-reporter, i need to provide an option allowing me to use that utility.
Describe the solution you'd like
A hook allowing you to change options, modifying them, removing them or whatnot.
It must be below the pytest_addoption, so plugins providing their own configurations can be modified and before pytest_configure.
from _pytest.config import Config
def pytest_modifyoptions(config: Config):
"""
This is a hook that allows you to modify configurations both loaded
from commandline but also from plugins"""
config.option.plugins.append("-p no:logging")
By having a solution like this, you are able to utilize other plugins and change their default configurations which is nice for some utilities.
One disadvantage is that modifying a plugin's default configurations can be a not-so-good practice since it can be hard to debug, but I also think most people would not do this unless they have a good reason for doing it.
Alternative Solutions
I did ask about this earlier and did not find a proper solution.
#11305