GoIT, Python WEB, Homework number 14. Documentation. Testing.
У цьому домашньому завданні ми продовжуємо доопрацьовувати наш REST API
застосунок із домашнього завдання 13.
- За допомогою
Sphinx
створіть документацію для вашого домашнього завдання. Для цього додайте в основних модулях до необхідних функцій і методів класів рядкиdocstrings
. - Покрийте модульними тестами модулі репозиторію домашнього завдання, використовуючи фреймворк
Unittest
. За основу візьміть приклад із конспекту для модуляtests/test_unit_repository_notes.py
- Покрийте функціональними тестами будь-який маршрут на вибір з вашого домашнього завдання, використовуючи фреймворк pytest.
- Покрийте ваше домашнє завдання тестами більш ніж на 95%. Для контролю використовуйте пакет
pytest-cov
poetry add sphinx --group dev
або
poetry update
poetry add pytest-cov -G test
pytest --cov=. --cov-report term tests/
>pytest --cov=. --cov-report html tests/
========================================================================== test session starts ===========================================================================
platform win32 -- Python 3.11.6, pytest-7.4.3, pluggy-1.3.0
rootdir: C:\Users\lexxa\Developments\GoIT\Python\Python 15\Web\goit_python_web_hw_14
configfile: pyproject.toml
plugins: anyio-3.7.1, Faker-20.1.0, cov-4.1.0, mock-3.12.0
collected 28 items
tests\test_pytest_route_contacts.py ........ [ 28%]
tests\test_pytest_route_users.py ...... [ 50%]
tests\test_unit_repository_contacts.py .............. [100%]
---------- coverage: platform win32, python 3.11.6-final-0 -----------
Coverage HTML written to dir htmlcov
Docker Hub url: https://hub.docker.com/r/lexxai/web_hw14