Replies: 1 comment
|
Hi @TylerYep The ordering is the important part here: when an installed plugin's So a There are two supported designs. If the value truly has to be known while options are registered, the provider needs to be another plugin which is loaded early, for example through an installed entry point or Otherwise, register the option with a neutral value: def pytest_addoption(parser):
parser.addoption("--my-option", default=None)and determine the effective default later, such as in The latter is normally simpler. The tradeoff is that argparse's help output cannot display that late-computed value as its registration-time default. Please mark this answer as accepted if it helped, thank you. |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Is it possible to run the pytest_addoption after my conftest.py? I was trying to follow https://docs.pytest.org/en/6.2.x/writing_plugins.html#using-hooks-in-pytest-addoption but I don't understand how it works when using the plugin in a separate package.
All reactions