我有一个使用TravisCI的Python项目,但是我的pytest
命令在Travis上失败并在本地计算机上传递。我认为原因是我在本地计算机中使用了Python-3.6.7,因为Travis在使用Python -3.6.3
我的.travis.yml
文件:
language: python
python:
- "3.6"
- "3.6-dev" # 3.6 development branch
# command to install dependencies
before_install:
# install python 3.6.7
install:
- pip install -r requirements.txt
- pip install -U pytest
# command to run tests
script:
- pytest
我的本地pytest日志:
platform linux -- Python 3.6.7, pytest-4.0.2, py-1.7.0, pluggy-0.8.0
# tests passed.
我的travis pytest日志:
platform linux -- Python 3.6.3, pytest-4.0.2, py-1.7.0, pluggy-0.8.0
#tests failed.
所以我认为使用3.6.7 Python版本可以修复我的测试,有人可以帮忙吗?
我尝试过的事情:
pip install -U python
不起作用。
答案 0 :(得分:0)
我在travis文件中使用了dist: xenial
,例如:
dist: xenial
python:
- "3.6"
---- so on ---
,默认情况下它带有Python 3.6.7。 :)