🎪 놀고있네/Python
[Python] PyTest-html
냥장판
2024. 5. 1. 21:38
반응형
pytest를 사용하면 테스트 결과 리포트 html 을 출력할 수 있다.
pip install pytest-html
테스트 파일
# test_ex1.py
import pytest
def func(x):
return x + 1
def test_answer():
assert func(3) == 5
pytest test_ex1.py --html=report.html
위 명령을 실행하면 현재 디렉토리에 report.html 파일이 생성되며, 이 파일은 테스트 실행 결과를 포함한 시각적인 HTML 리포트를 제공한다.
참고
https://pytest-html.readthedocs.io/en/latest/installing.html
Installation — pytest-html documentation
Requirements pytest-html will work with Python >=3.6 or PyPy3.
pytest-html.readthedocs.io
반응형