amazon-web-services - 使用 aws 为 gitlab 创建 CI 管道时出错
问题描述
我正在使用下面的代码在 gitlab 中创建一个带有 aws 的 ci 管道来为 ci 工作。我只需要为它执行 3 个阶段,并且我只发布了代码以进行覆盖,因为我收到错误初始化
coverage:
stage: test
tags:
- aws-runner
only:
- Feature/CI
image: python:3.7-slim
coverage: '/TOTAL\s+\d+\s+\d+\s+(\d+%)/'
script:
- pip install coverage moto mock pytest
- MIN_COVERAGE=85
- pip3 install --upgrade pip setuptools wheel
- pip3 install -r requirements.txt
- coverage run --omit 'utility/*' -m pytest tests/
- coverage report -m
- coverage html
- COVERAGE=$(coverage report -m | grep -i "TOTAL" | awk '{print $4}' | sed 's/%//')
- if [ "$COVERAGE" -lt "$MIN_COVERAGE" ]; then exit 1; else exit 0; fi
artifacts:
expire_in: 7 days
paths:
- htmlcov/
这是上面代码的错误
$ coverage run --omit 'utility/*' -m pytest tests/
============================= test session starts==============================
platform linux -- Python 3.7.11, pytest-6.2.4, py-1.10.0, pluggy-0.13.1 rootdir: /builds/test-backend
collected 0 items
============================ no tests ran in 0.00s =============================
ERROR: file or directory not found: tests/
Coverage.py warning: No data was collected. (no-data-collected)
Cleaning up file based variables
00:02
ERROR: Job failed: exit code 1
因为我是新手,有什么建议吗?我该如何解决这个问题?
解决方案
我认为您需要检查测试目录是否存在,它应该有 .py 文件
推荐阅读
- angular - Angular 9 - 拦截器 - 如果 catcherror 中没有错误返回什么?
- python - 如何在超大图中创建动态子图?
- python-3.x - Python 正则表达式按人名分组句子
- r - REST API 与 R Plumber - GeoJSON 作为输入
- python-3.x - 如何在 Python3 脚本中使用 PyPDF2 从 PDF 中读取阿拉伯文本
- spring-mvc - 百里香叶 | th:each 中的参数化段
- search - 搜索关键字时出现意外的 solr 结果集
- android-studio - ScrollView 不滚动
- java - 如何在java中为图像创建http响应?
- reactjs - 如何在不重新渲染的情况下访问 redux 连接 mapStateToProps