How can I point tox to all python versions in a portable way (eg. without hard-coding the paths in tox.ini)?

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

  •  08-10-2022
  •  | 
  •  

Frage

I'd like to run tox for python 2.6, 2.7, 3.3, etc. and am looking for a way to do this that doesn't involve hard-coding the python paths into a project's tox.ini like I'm currently doing:

[testenv:py27]
    basepython=/usr/prog/python/2.7.5/bin/python

since this breaks when run on a different machine. Does tox have some global config file where I can set this (didn't find the answer in ~/.tox/ or in the manual)?

Thanks

-Ben

War es hilfreich?

Lösung

You should be able to just name the Python version you want. Tox will figure out the path.

basepython = python2.7

If that doesn't work for you, Tox supports environment substitutions inside curly braces.

{envname} The name of the virtual environment

{envpython} Path to the virtual Python interpreter

{envdir} Directory of the virtualenv hierarchy

More info in the Tox documentation

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