无法使用Travic CI从GitHub存储库运行我的Python文件:导入错误

问题描述 投票:0回答:1

Travis CI无法正常工作。 SSW-567是我的主目录,它有一个文件夹HW02,其中有一个文件夹HW02a。我有一个名为TestTriangle.py的python文件,该文件位于SSW-567> HW02> HW02a> TestTriangle.py中。

我的.travis.ci文件包含:

language: python
python:
 - "3.7.1"

# command to run tests
script:
 - python -m unittest /tree/master/HW02/HW02a/TestTriangle

它位于SSW-567(我的主存储库)中

为什么会给我ImportError?

python travis-ci
1个回答
0
投票

Travis CI从travis.yml文件所在的目录的根目录运行python。

应该是

script:
 - python -m unittest HW02/HW02a/TestTriangle

签出the simplejson travis.yml file for an example of referring to a file in the git repo

© www.soinside.com 2019 - 2024. All rights reserved.