Specifying exact Python version for Travis CI in combination with tox

I have the following .travis.yml:

language: python

env:
  - TOXENV=py27
  - TOXENV=py34

install:
  - pip install -U tox

script:
  - tox

and the following tox.ini:

[tox]
envlist = py27,py34

[testenv]
commands = py.test tests/
deps = -rtests/test_requirements.txt

I need Python 3.4.3, which is available since awhile back in Travis. How can I specify this exact version of Python in .travis.yml so tox can use the correct version for the py34 environment?

Best answer

Inspired by pip‘s .travis.yml it seems easiest to specify the Travis matrix with different environment variables:

matrix:
    include:
        - python: 3.4.3
          env: TOXENV=py34
        - python: 2.7
          env: TOXENV=py27