How to convince python tox to run tests only for the available python interpreters?

StackOverflow https://stackoverflow.com/questions/13365876

  •  29-11-2021
  •  | 
  •  

Frage

I am using python tox to run python unittest for several versions of python, but these python interpreters are not all available on all machines or platforms where I'm running tox.

How can I configure tox so it will run tests only when python interpretors are available.

Example of tox.ini:

[tox]
envlist=py25,py27

[testenv]
...
[testenv:py25]
...

The big problem is that I do want to have a list of python environments which is auto-detected.

War es hilfreich?

Lösung

As of Tox version 1.7.2, you can pass the --skip-missing-interpreters flag to achieve this behavior. You can also set skip_missing_interpreters=true in your tox.ini file. More info here.

[tox]
envlist =
    py24, py25, py26, py27, py30, py31, py32, py33, py34, jython, pypy, pypy3
skip_missing_interpreters =
    true

Andere Tipps

First if you don't have tox : pip install tox.

Use this command : tox --skip-missing-interpreters , it skips for the compilers which are not available locally and just runs for the available versions of python

tox will display an Error if an interpreter cannot be found. Question is up if there should be a "SKIPPED" state and making tox return a "0" success result. This should probably be explicitely enabled via a command line option. If you agree, file an issue at http://bitbucket.org/hpk42/tox .

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top