Tox and missing interpreters (was: Tox basepython and Python3)

Stephen Finucane stephenfin at redhat.com
Tue May 12 09:48:53 UTC 2020


On Mon, 2020-05-11 at 18:20 +0000, Jeremy Stanley wrote:
> 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.

The 'py3' option listed below is a better one, but for those that
*really* want this behavior:

   alias 'tox=tox --skip-missing-interpreters'

Your tests all "pass" locally, but the gate continues to properly test
things.

Alternatively, use Fedora where all supported Python versions are
packaged by default and this isn't an issue :P

Stephen

> 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.




More information about the openstack-discuss mailing list