On Sun, Dec 9, 2018 at 4:35 PM Oscar Benjamin <oscar.j.benja...@gmail.com>
wrote:

> It's not a huge problem. If it were possible to set them in
> conftest.py I'd rather do that because the pytest.ini doesn't exist
> yet and I'd like to keep everything in one file if possible.
>
> I spent a little time trying to work out if was possible: I just
> imagined there would be a generic way to set ini options from the
> conftest.py file. It's not needed in this case but the advantage of
> being able to set those things in conftest.py could be if you want to
> make them conditional on something.
>

Sure, makes sense. We could add a new "config.setini" option, for one it
would allow users to set ini values in pytest_configure, I remember needing
this in more than one occasion actually.

There's a discussion about this in
https://github.com/pytest-dev/pytest/issues/3311, in there the OP wanted to
do this so plugins could change ini options from other plugins (all under
his control) so it was considered a little brittle, but I think the use
case for changing ini variables during pytest_configure like you describe
is a strong motivation for us to add this API.

Ronny, what's your opinion?

Cheers,
Bruno.
_______________________________________________
pytest-dev mailing list
pytest-dev@python.org
https://mail.python.org/mailman/listinfo/pytest-dev

Reply via email to