我第一次尝试为我的应用程序设置Circle CI。这是一个基于python 3.7.0的应用程序,带有一些测试。应用程序构建得很好,但在运行测试作业时失败。本地测试工作正常,所以我假设我缺少一些Circle CI配置
这是我的yaml:
version: 2.0
jobs:
build:
docker:
- image: circleci/python:3.7.0
steps:
- checkout
- run:
name: "Run tests"
command: python -m unittest
这就是错误:
======================================================================
ERROR: tests.test_auth (unittest.loader._FailedTest)
ImportError: Failed to import test module: tests.test_auth Traceback (most recent call last): File "/usr/local/lib/python3.7/unittest/loader.py", line 434, in _find_test_path module = self._get_module_from_name(name) File "/usr/local/lib/python3.7/unittest/loader.py", line 375, in _get_module_from_name import(name) File "/home/circleci/project/tests/test_auth.py", line 5, in from werkzeug.datastructures import MultiDict ModuleNotFoundError: No module named 'werkzeug'
我错过了什么
编辑:
我现在已经添加了pip install -r requirements.txt
,但我现在得到了:
Could not install packages due to an EnvironmentError: Errno 13] Permission denied: '/usr/local/lib/python3.7/site-packages/MarkupSafe-1.1.1.dist-info'
编辑:
除了答案之外,这里还有完整的yaml配置:
version: 2.0
jobs:
build:
docker:
- image: circleci/python:3.7.0
steps:
- checkout
- run:
name: "Install dependencies"
command: |
python3 -m venv venv
. venv/bin/activate
pip install --upgrade pip
pip install --no-cache-dir -r requirements.txt
- run:
name: "Run tests"
command: |
. venv/bin/activate
python -m unittest
这仅仅意味着没有安装依赖项“werkzeug”。您可能需要安装另外需要的软件包
考虑将依赖性安装添加到DOCKLILE文件中,如下面的
如果您遇到权限被拒绝的问题,那么测试将由没有权限管理python的用户启动。但这不太可能
相关问题 更多 >
编程相关推荐