Doc: https://flask.palletsprojects.com/en/2.3.x/testing/ Doc de PyTest : https://docs.pytest.org/en/8.0.x/
Tutorials:
pip install pytest
./my_project /app /static ... /templates ... /tests __init__.py (fichier vide) test_articles.py test_fonctions.py test_divers.py ... __init__.py (racine de l'application)
from ..services.tools import sub_month import pytest, datetime def test_sub_month_1(): d1 = datetime.datetime(2023, 3, 15) d2 = sub_month(d1) assert d2.year == 2023 assert d2.month == 2 assert d2.day == 15
pytest