Tox and missing interpreters (was: Tox basepython and Python3)
fungi at yuggoth.org
Mon May 11 18:20:25 UTC 2020
On a related note, the proliferation of tested Python versions has
led many projects to enable the skip_missing_interpreters option in
their tox.ini files. Please don't, this is just plain DANGEROUS.
I know it's nice that when you've got a bunch of Python versions in
your default tox envlist some of which a typical developer may not
have installed, they can still run `tox` and not get errors about
those. However, it also means that if you run `tox -e py38` and
don't have any Python 3.8 interpreter, tox will happily say it did
nothing successfully. Yes it's fairly obvious when you see it happen
locally. It's far less obvious when you add a Python 3.8 job in the
gate but don't make sure that interpreter is actually installed then
and get back a +1 from Zuul when tox ran no tests at all.
An alternative solution, which some projects like Zuul have switched
to, is not listing a bunch of specific pyXY versions in the tox
envlist, but just putting "py3" instead. This will cause folks who
are running `tox` to get unit tests with whatever their default
python3 interpreter is, but also they'll get a clear error if they
don't have any python3 interpreter at all. If someone has Python 3.8
installed and it isn't their default python3 but they still want to
test with it, they can of course do `tox -e py38` and that will work
as expected. This also means you no longer have to update the
envlist in tox.ini every time you add or remove support for a
specific interpreter version. Besides, tox.ini is not a good place
to list what versions of the interpreter your project supports,
that's what trove classifiers in the setup.cfg file are for.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 963 bytes
Desc: not available
More information about the openstack-discuss