14

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.

NullUserException
  • 83,810
  • 28
  • 209
  • 234
sorin
  • 161,544
  • 178
  • 535
  • 806
  • Doesn't it already do that? I recall that is detects missing interpreters and skips the associated tests (quite quickly too). –  Nov 13 '12 at 17:46

3 Answers3

17

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
dfarrell07
  • 2,872
  • 2
  • 21
  • 26
0

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

Yu Hao
  • 119,891
  • 44
  • 235
  • 294
-3

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 .

hpk42
  • 21,501
  • 4
  • 47
  • 53
  • 1
    I added a feature request https://bitbucket.org/hpk42/tox/issue/59/allow-tox-to-ignore-missing-python Tx – sorin Nov 14 '12 at 12:45
  • 1
    You could recommend usage of SO for most tox/pytest relates questions - as main support option. It's much better than any mailinglist. Still, mailing list has it's use. – sorin Nov 14 '12 at 12:46
  • 1
    i think i am already recommending it, at least for pytest. Only caveat is that answers that were good 3 years ago might not be good/valid anymore now. – hpk42 Nov 14 '12 at 18:08
  • I can only hope that SO will change the policy regarding accepted answers, the pressure is building so it will happen eventually. – sorin Nov 14 '12 at 18:12