Travis CI 和具有多个 python 版本的 pytest

Travis CI and pytest with multiple python versions

我在 .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

问题是 python <= 3.5 是 py.test 而不是 pytest

如何告诉 travis 使用 py.test 表示“3.4”和“3.5”?

找到了我的问题的答案。

script 部分更改为:

script:
    - if [[ $TRAVIS_PYTHON_VERSION == 3.4 || $TRAVIS_PYTHON_VERSION == 3.5 ]]; then py.test;else pytest; fi