Tests: the cycle builds every dbt cohort of each project, CaMa's survival cohort included

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HmQxVJVNR5FYkPAregGEQ7
This commit is contained in:
2026-11-21 02:14:26 -06:00
parent f34c2b5116
commit 2ee95576a8
+7 -5
View File
@@ -66,16 +66,18 @@ def test_volver_a_correr_no_agrega_reportes(bases):
assert con.execute(text("SELECT COUNT(*) FROM measure_report")).scalar_one() == antes assert con.execute(text("SELECT COUNT(*) FROM measure_report")).scalar_one() == antes
def test_en_cacu_arma_cada_cohorte_de_dbt_una_vez(bases): def test_arma_cada_cohorte_de_dbt_una_vez(bases):
"""Pins down: the cycle builds every cohort of the project in dbt's manifest, once each, and each build stores """Pins down: the cycle builds every cohort of the project in dbt's manifest, once each, and each build stores
as many members as it counts. TEA and CaMa have no dbt cohorts, so no cohort step. Fails if a cohort comes from as many members as it counts (CaCu's, CaMa's survival cohort); a project without dbt cohorts (TEA) has no cohort
anywhere else than dbt, or a build's count and members disagree.""" step. Fails if a cohort comes from anywhere else than dbt, or a build's count and members disagree."""
proyecto, ctx, motor, _, pasos = bases proyecto, ctx, motor, _, pasos = bases
if proyecto != "cacu": urls = set(cohort_urls(proyecto, ctx.dbt_manifest))
if not urls:
assert "cohorts" not in [p.name for p in pasos] assert "cohorts" not in [p.name for p in pasos]
return return
armados = [p.summary for p in pasos if p.name == "cohorts"][0] armados = [p.summary for p in pasos if p.name == "cohorts"][0]
assert set(armados) == set(cohort_urls(proyecto, ctx.dbt_manifest)) and "cacu/cohorte_vigilancia" in armados assert set(armados) == urls
assert {"cacu": "cacu/cohorte_vigilancia", "cama": "cama/cohorte_supervivencia"}[proyecto] in armados
with motor.connect() as con: with motor.connect() as con:
assert con.execute(text("SELECT COUNT(*) FROM cohorte_armado")).scalar_one() == len(armados) assert con.execute(text("SELECT COUNT(*) FROM cohorte_armado")).scalar_one() == len(armados)
for armado_id, _ in armados.values(): for armado_id, _ in armados.values():