Merge origin/feature/cohorts-dbt-canonical
This commit is contained in:
@@ -66,18 +66,18 @@ def test_volver_a_correr_no_agrega_reportes(bases):
|
||||
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
|
||||
as many members as it counts. TEA has no dbt cohorts, so no cohort step; CaCu's include the surveillance cohort
|
||||
and CaMa's the total cohort. Fails if a cohort comes from anywhere else than dbt, or a build's count and members
|
||||
disagree."""
|
||||
as many members as it counts (CaCu's, CaMa's total and survival cohorts); a project without dbt cohorts (TEA) has no
|
||||
cohort step. Fails if a cohort comes from anywhere else than dbt, or a build's count and members disagree."""
|
||||
proyecto, ctx, motor, _, pasos = bases
|
||||
if proyecto == "tea":
|
||||
urls = set(cohort_urls(proyecto, ctx.dbt_manifest))
|
||||
if not urls:
|
||||
assert "cohorts" not in [p.name for p in pasos]
|
||||
return
|
||||
armados = [p.summary for p in pasos if p.name == "cohorts"][0]
|
||||
principal = {"cacu": "cacu/cohorte_vigilancia", "cama": "cama/cohorte_total"}[proyecto]
|
||||
assert set(armados) == set(cohort_urls(proyecto, ctx.dbt_manifest)) and principal in armados
|
||||
assert set(armados) == urls
|
||||
assert ({"cacu/cohorte_vigilancia"} if proyecto == "cacu" else {"cama/cohorte_total"}) <= set(armados)
|
||||
with motor.connect() as con:
|
||||
assert con.execute(text("SELECT COUNT(*) FROM cohorte_armado")).scalar_one() == len(armados)
|
||||
for armado_id, _ in armados.values():
|
||||
|
||||
Reference in New Issue
Block a user