Travis收集...命令“ pytest”以1退出

时间:2019-10-18 06:31:44

标签: python pytest travis-ci

对于项目https://github.com/WolfgangFahl/play-chess-with-a-webcam和travis配置:

# see https://docs.travis-ci.com/user/languages/python/
language: python
# python versions to be tested
python:
#  - "2.7" # see https://github.com/WolfgangFahl/gremlin-python-tutorial/issues/7
  - "3.7"
# command to install dependencies
install:
  - pip install -r requirements.txt
# command to run tests
script:
  - pytest

我收到错误消息:

collecting ... The command "pytest" exited with 1.
在travis环境中

。在本地时,我得到:

============================== test session starts ==============================
platform darwin -- Python 3.7.4, pytest-5.2.1, py-1.8.0, pluggy-0.12.0
rootdir: /Users/wf/source/python/play-chess-with-a-webcam
collected 5 items                                                               

test_OpenCV_version.py .                                                  [ 20%]
test_Video.py ..                                                          [ 60%]
test_findBoard.py ..                                                      [100%]

=============================== 5 passed in 7.03s ===============================

错误原因是什么?

我该如何解决?

1 个答案:

答案 0 :(得分:0)

错误原因是什么? 测试具有OpenCV GUI输出,无头的情况让pytest令人窒息。

我该如何解决? 将以下内容添加到.travis.yml

# allow gui output
services:
  - xvfb