5

I do have a complex tox.ini configuration with multiple environments for different versions of python.

I would like to know how to tell tox to run coverage only on the default python interpretor.

One of the problems is that the default python environment can be different from one platform to another.

I do have a wrapper script which calls tox -e py25,py26,docs where the -e arguments are the detected versions of python.

[tox]
     ...
[testenv:docs]
     ...
[testenv]
     commands=py.test --cov-report xml --cov scripts
     ...
[testenv:py26]
     ...
[testenv:py25]
     ...

Desired behaviour: run pytest with coverage for a single environment (this is supposed to run integrated with jenkins).

sorin
  • 161,544
  • 178
  • 535
  • 806

1 Answers1

5

I think you could use and include the [testenv:py] environment which uses the python interpreter with which tox is invoked itself. If you define the coverage-run there you should get what you want.

hpk42
  • 21,501
  • 4
  • 47
  • 53
  • Thanks, this is what I was looking for! Now I can setup tox to run in two modes: quick (run only `py`) and full (run with all available interpretors including execution on remote platforms via pytest-xdist). – sorin Dec 07 '12 at 10:02
  • Hi, please update the answer to include the way it works. I just tried using that environment, but it actually didn't run coverage. I am trying to test with python 2.7.5 and 3.4.4. Thanks. – Efren Apr 04 '16 at 01:40