The installation instructions referenced by @dimitry-cheremushkin have been changed and recommend using pyenv instead. Tox and Pyenv can be used together like this:
First we ensure we have pyenv
installed:
$ brew update
$ brew install pyenv
Then we install all the needed python versions with pyenv
. This might take time. See python.org/downloads for available versions.
$ pyenv install 2.6.9 && pyenv ... && pyenv install 3.5.0
In the directory of our setup.py, let us run pyenv local ...
as below. It will create .python-version
file that stores the versions to be used.
$ pyenv local 2.6.9 2.7.10 3.2.6 3.3.6 3.4.3 3.5.0
So, pyenv
installed the Python distributions to a dir ~/.pyenv/shims
. To let them to be found instead default Python, the dir must be prepended to the PATH environment variable. Even though more permanent solutions exist, the following does the trick for one terminal session:
$ eval "$(pyenv init -)"
$ echo $PATH
/Users/myname/.pyenv/shims:/usr/bin:...
The following has been recommended to be run to ensure the shims have correct packages:
$ pyenv rehash
Now, let us assume the following tox.ini
:
[tox]
envlist = py26,py27,py30,py31,py32,py33,py34,py35
[testenv]
deps=
nose2
unittest2
commands=nose2
Finally we can run tox
in all the environments:
$ tox
...
py26: commands succeeded
py27: commands succeeded
py30: commands succeeded
py31: commands succeeded
py32: commands succeeded
py33: commands succeeded
py34: commands succeeded
py35: commands succeeded
congratulations :)