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

标签 python travis-ci pytest

我在 .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 对“3.4”和“3.5”使用 py.test

最佳答案

找到了我的问题的答案。

script 部分更改为:

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

关于python - Travis CI 和 pytest 具有多个 python 版本,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41261590/

相关文章:

python - 如何自动更改为所有doctests的pytest临时目录

python - 在pytest中重用数据结构

python - 如何让 __init__ 获取新值或现有实例?

python - 使用 Python 删除 DynamoDB 的所有项目

travis-ci - Travis CI 部署脚本中的符号 *1 或 &2 是什么意思?

python - 将 Cythonization 添加到 setup.py 时,Travis 日志颜色消失

python - 如何将类属性和值传递给 Markdown 语法

python - 如何在 matplotlib 等高线图中设置破折号长度

travis-ci - Travis CI 部署到 S3 存储桶不使用安全 key

python - 如何在每个单元测试中重置fixture的某些属性?