小编dnr*_*nrp的帖子

如何为 Gitlab 配置 Python coverage.pl 报告

我是 Gitlab 的新手,试图为 Gitlab 设置覆盖率报告 -m。当我手动运行时,coverage report -m 给我报告。只是无法弄清楚需要做什么才能在 Gitlab 上显示该显示。

这需要在 Linux for Gitlab 上使用 Python 3.6 单元测试代码覆盖率运行。

这是我的 yml 文件

stages: 
- build 
- test 
- coverage
- deploy

before_script:
  - pip install -r requirements.txt

unit-tests:  
 image:    
  name: "python:3.6"  
 stage: test  
 script: python -m unittest discover

test:
 image:   
  name: "python:3.6"
 stage: test
 script: 
   - python my_Project_Lib/my_test_scripts/runner.py

coverage:
  stage: test
  script:
      - python -m unittest discover
      - coverage report -m
      - coverage-badge

  coverage: '/TOTAL.+ ([0-9]{1,3}%)/'
Run Code Online (Sandbox Code Playgroud)

这可以很好地运行我的单元测试和 runer.pl,还可以运行覆盖率。您将需要在 requrements.txt 中进行以下操作 …

linux coverage.py python-3.x gitlab-ci-runner

3
推荐指数
1
解决办法
4745
查看次数

标签 统计

coverage.py ×1

gitlab-ci-runner ×1

linux ×1

python-3.x ×1