feat: infrastructure — pyproject.toml, requirements-dev, conftest, pytest-cov
Ajoute pyproject.toml (pytest strict markers, coverage fail_under=55), requirements-dev.txt (pytest-cov, pytest-xdist), et tests/conftest.py avec fixtures partagées (dossier_minimal, dossier_complet, controle_cpam). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
22
pyproject.toml
Normal file
22
pyproject.toml
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
[build-system]
|
||||||
|
requires = ["setuptools>=68.0"]
|
||||||
|
build-backend = "setuptools.backends._legacy:_Backend"
|
||||||
|
|
||||||
|
[project]
|
||||||
|
name = "t2a"
|
||||||
|
version = "2.0.0"
|
||||||
|
requires-python = ">=3.12"
|
||||||
|
|
||||||
|
[tool.pytest.ini_options]
|
||||||
|
testpaths = ["tests"]
|
||||||
|
addopts = "--strict-markers -x -q"
|
||||||
|
markers = ["integration: tests requiring Ollama"]
|
||||||
|
|
||||||
|
[tool.coverage.run]
|
||||||
|
source = ["src"]
|
||||||
|
omit = ["src/viewer/templates/*"]
|
||||||
|
|
||||||
|
[tool.coverage.report]
|
||||||
|
fail_under = 55
|
||||||
|
show_missing = true
|
||||||
|
exclude_lines = ["pragma: no cover", "if __name__", "except ImportError"]
|
||||||
3
requirements-dev.txt
Normal file
3
requirements-dev.txt
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
-r requirements.txt
|
||||||
|
pytest-cov>=4.1.0
|
||||||
|
pytest-xdist>=3.5.0
|
||||||
80
tests/conftest.py
Normal file
80
tests/conftest.py
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
"""Fixtures partagées pour les tests T2A."""
|
||||||
|
|
||||||
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import pytest
|
||||||
|
|
||||||
|
from src.config import (
|
||||||
|
ActeCCAM,
|
||||||
|
Antecedent,
|
||||||
|
BiologieCle,
|
||||||
|
Complication,
|
||||||
|
ControleCPAM,
|
||||||
|
Diagnostic,
|
||||||
|
DossierMedical,
|
||||||
|
Imagerie,
|
||||||
|
Sejour,
|
||||||
|
Traitement,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def dossier_minimal() -> DossierMedical:
|
||||||
|
"""Dossier médical minimal : DP seul, pas de DAS/bio/imagerie."""
|
||||||
|
return DossierMedical(
|
||||||
|
source_file="test_minimal.pdf",
|
||||||
|
document_type="crh",
|
||||||
|
sejour=Sejour(sexe="M", age=65, duree_sejour=5),
|
||||||
|
diagnostic_principal=Diagnostic(
|
||||||
|
texte="Cholécystite aiguë",
|
||||||
|
cim10_suggestion="K81.0",
|
||||||
|
),
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def dossier_complet() -> DossierMedical:
|
||||||
|
"""Dossier médical enrichi : DP + DAS + bio + imagerie + traitements."""
|
||||||
|
return DossierMedical(
|
||||||
|
source_file="test_complet.pdf",
|
||||||
|
document_type="crh",
|
||||||
|
sejour=Sejour(sexe="M", age=65, duree_sejour=5, imc=31.2),
|
||||||
|
diagnostic_principal=Diagnostic(
|
||||||
|
texte="Cholécystite aiguë",
|
||||||
|
cim10_suggestion="K81.0",
|
||||||
|
),
|
||||||
|
diagnostics_associes=[
|
||||||
|
Diagnostic(texte="Iléus réflexe", cim10_suggestion="K56.0"),
|
||||||
|
],
|
||||||
|
actes_ccam=[
|
||||||
|
ActeCCAM(texte="Cholécystectomie", code_ccam_suggestion="HMFC004"),
|
||||||
|
],
|
||||||
|
biologie_cle=[
|
||||||
|
BiologieCle(test="CRP", valeur="180", anomalie=True),
|
||||||
|
BiologieCle(test="Créatinine", valeur="450", anomalie=True),
|
||||||
|
],
|
||||||
|
imagerie=[
|
||||||
|
Imagerie(type="Scanner abdominal", conclusion="Lithiase cholédocienne confirmée"),
|
||||||
|
],
|
||||||
|
traitements_sortie=[
|
||||||
|
Traitement(medicament="Augmentin IV", posologie="3g/j"),
|
||||||
|
Traitement(medicament="Morphine SC"),
|
||||||
|
],
|
||||||
|
antecedents=[
|
||||||
|
Antecedent(texte="HTA"),
|
||||||
|
Antecedent(texte="Diabète type 2"),
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.fixture
|
||||||
|
def controle_cpam() -> ControleCPAM:
|
||||||
|
"""Contrôle CPAM de test avec codes contestés."""
|
||||||
|
return ControleCPAM(
|
||||||
|
numero_ogc=12345,
|
||||||
|
titre="Contestation du codage CIM-10",
|
||||||
|
arg_ucr="Le codage du DP K81.0 est contesté, proposition K80.2",
|
||||||
|
decision_ucr="Modification du DP",
|
||||||
|
dp_ucr="K80.2",
|
||||||
|
da_ucr="K56.0",
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user