2

I have the following in .travis.yml:

language: python
python:
  - "3.4"
  - "3.5"
  - "3.5-dev" # 3.5 development branch
  - "3.6-dev" # 3.6 development branch
  - "nightly" # currently points to 3.7-dev
# command to run tests
script: pytest

The problem is that in python <= 3.5 it's py.test instead of pytest.

How do I tell travis to use py.test for "3.4" and "3.5"?

Chankey Pathak
  • 21,187
  • 12
  • 85
  • 133
Pär Berge
  • 196
  • 12
  • 1
    You could write your own Python script that invokes pytest as appropriate for the current version, and use that as the script. – jonrsharpe Dec 21 '16 at 11:21

1 Answers1

4

Found an answer to my question.

Changed the script section to:

script:
    - if [[ $TRAVIS_PYTHON_VERSION == 3.4 || $TRAVIS_PYTHON_VERSION == 3.5 ]]; then py.test;else pytest; fi
Pär Berge
  • 196
  • 12