Description
In #pylib
I discussed with @estan if there's some good way to configure PYTEST_QT_API
in a way which doesn't require passing it on the commandline, for cases where you always need it to be e.g. pyqt5
.
Unfortunately using pytest-env doesn't work as it uses pytest_load_initial_conftestst
which will be run after pytest-qt
is already imported.
One possibility would be to change pytest-qt
so it reads the API version from pytest.ini
. This should be doable but is probably quite painful, as it reqires delaying any imports from qt_compat
until after pytest_load_initial_conftests
(i.e. moving a lot of imports inside functions...).
Another possibility would be to add an env
option to pytest's core, but pytest would need to read it (and set the environment variables) before any plugins are loaded...
Alternatively pytest-qt
could search a pytestqt.ini
or so in the current directory, but that'd also break in various circumstances and isn't really nice either.
What do you think?