我有这样一个buildspec文件:
version: 0.2
phases:
install:
commands:
- pip install pytest
- pip install pytest-cov
- pip install .
build:
commands:
- python -m pytest --junitxml=unittests.xml
reports:
unit_tests:
files:
- unittests.xml
file-format: JUNITXML它成功构建,我可以按预期在Report groups下查看我的报告。
现在,我想对其进行扩展,并使用--cov-report选项查看覆盖范围。我试过了
version: 0.2
phases:
install:
commands:
- pip install pytest
- pip install pytest-cov
- pip install .
build:
commands:
- python -m pytest --junitxml=unittests.xml --cov-report=xml:coverage.xml
reports:
unit_tests:
files:
- unittests.xml
file-format: JUNITXML
coverage_tests:
files:
- coverage.xml
file-format: COBERTURAXML但没有成功。我得到了输出:
generated xml file: /codebuild/output/<removed>/unittests.xml
... <skipped a few lines here>
Report export config is NO_EXPORT, skip exporting reports
Preparing to copy CODE_COVERAGE report coverage_tests
Expanding base directory path: .
Assembling file list
Expanding .
Expanding file paths for base directory .
Assembling file list
Expanding coverage.xml
Skipping invalid file path coverage.xml
No matching report paths found
Phase complete: UPLOAD_ARTIFACTS State: SUCCEEDED
Phase context status code: Message:
Error in UPLOAD_ARTIFACTS phase: [coverage_tests: [report files not
found in build]]如何正确创建报告?
发布于 2022-01-16 11:52:02
正如@TeejayBruno在评论中指出的那样,我错过了所需的标志。
当我使用时(文件的其余部分保持不变)
- python -m pytest --junitxml=unittests.xml --cov-report=xml --cov=ronwo --cov-branch一切都如期而至。
https://stackoverflow.com/questions/70571744
复制相似问题