다음 절차는 pytest 테스트 프레임워크
이 절차를 수행하려면 다음 전제 조건이 필요합니다.
-
기존 CodeBuild 프로젝트가 있어야 합니다.
-
프로젝트는 pytest 테스트 프레임워크를 사용하도록 설정된 Python 프로젝트입니다.
buildspec.yml
파일의 build
또는 post_build
단계에 다음 항목을 추가합니다. 이 코드는 현재 디렉터리에서 테스트를 자동으로 검색하고 <test report directory>
/<report filename>
으로 지정된 파일로 테스트 보고서를 내보냅니다. 보고서는 JunitXml
형식을 사용합니다.
- python -m pytest --junitxml=<test report directory>
/<report filename>
buildspec.yml
파일에서 다음 섹션을 추가/업데이트합니다.
version: 0.2
phases:
install:
runtime-versions:
python: 3.7
commands:
- pip3 install pytest
build:
commands:
- python -m pytest --junitxml=<test report directory>
/<report filename>
reports:
pytest_reports:
files:
- <report filename>
base-directory: <test report directory>
file-format: JUNITXML