How to I configure tox so it will run pytest coverage on a single environment instead of all?

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

  •  05-12-2021
  •  | 
  •  

سؤال

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

هل كانت مفيدة؟

المحلول

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.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top