[PYTHON/COVERAGE] 테스트 커버리지 보고서 생성하기
■ 테스트 커버리지 보고서를 생성하는 방법을 보여준다. ▶ 실행 명령
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
(env) king@cosmos:~/testproject$ coverage run -m pytest ============================================================================================= test session starts ============================================================================================== platform linux -- Python 3.10.12, pytest-7.1.2, pluggy-1.0.0 rootdir: /home/king/testproject, configfile: pytest.ini plugins: asyncio-0.18.3, anyio-3.5.0 asyncio: mode=auto collected 9 items test/test_event.py ....... [ 77%] test/test_user.py .. [100%] =============================================================================================== warnings summary =============================================================================================== test/test_event.py::testCreateEvent test/test_event.py::testCreateEvent /home/king/testproject/env/lib/python3.10/site-packages/beanie/odm/settings/document.py:53: DeprecationWarning: Collection inner class is deprecated, use Settings instead warnings.warn( -- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html ======================================================================================== 9 passed, 2 warnings in 0.33s ========================================================================================= (env) king@cosmos:~/testproject$ coverage report Name Stmts Miss Cover ------------------------------------------------- application_setting.py 13 0 100% auth/auth_helper.py 9 1 89% auth/hash_helper.py 7 0 100% auth/jwt_helper.py 21 4 81% database/db_helper.py 10 0 100% database/document_helper.py 32 2 94% main.py 20 3 85% model/event.py 22 0 100% model/user.py 12 0 100% route/event.py 41 4 90% route/user.py 27 3 89% test/__init__.py 0 0 100% test/conftest.py 22 0 100% test/test_event.py 60 0 100% test/test_user.py 17 0 100% ------------------------------------------------- TOTAL 313 17 95% (env) king@cosmos:~/testproject$ coverage html Wrote HTML report to htmlcov/index.html |