Coverage for src/debputy/integration_detection.py: 83%
16 statements
« prev ^ index » next coverage.py v7.8.2, created at 2025-10-12 15:06 +0000
« prev ^ index » next coverage.py v7.8.2, created at 2025-10-12 15:06 +0000
1from typing import Optional
2from collections.abc import Container, Mapping
4from debputy.plugin.api.spec import (
5 DebputyIntegrationMode,
6 INTEGRATION_MODE_DH_DEBPUTY_RRR,
7 INTEGRATION_MODE_DH_DEBPUTY,
8 INTEGRATION_MODE_FULL,
9)
12def determine_debputy_integration_mode(
13 source_fields: Mapping[str, str],
14 all_sequences: Container[str],
15) -> DebputyIntegrationMode | None:
17 if source_fields.get("Build-Driver", "").lower() == "debputy": 17 ↛ 18line 17 didn't jump to line 18 because the condition on line 17 was never true
18 return INTEGRATION_MODE_FULL
20 has_zz_debputy = "zz-debputy" in all_sequences or "debputy" in all_sequences
21 has_zz_debputy_rrr = "zz-debputy-rrr" in all_sequences
22 has_any_existing = has_zz_debputy or has_zz_debputy_rrr
23 if has_zz_debputy_rrr:
24 return INTEGRATION_MODE_DH_DEBPUTY_RRR
25 if has_any_existing:
26 return INTEGRATION_MODE_DH_DEBPUTY
27 if source_fields.get("Source", "") == "debputy": 27 ↛ 29line 27 didn't jump to line 29 because the condition on line 27 was never true
28 # Self-hosting. We cannot set the Build-Driver field since that creates a self-circular dependency loop
29 return INTEGRATION_MODE_FULL
30 return None