Skip to content

Commit 5ca1241

Browse files
baogorekclaude
andcommitted
Stub l0 module in test so patch works without l0-python installed
Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
1 parent d268eff commit 5ca1241

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

tests/unit/calibration/test_unified_calibration.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,24 @@
55
block-level takeup seeding, county precomputation, and CLI flags.
66
"""
77

8+
import sys
9+
import types
10+
811
import numpy as np
912
import pytest
1013
import scipy.sparse as sp
1114
from types import SimpleNamespace
1215
from unittest.mock import patch
1316

17+
# Ensure `l0.calibration` is importable so patch() can traverse the path
18+
# even when the real l0-python package is not installed (e.g. CI).
19+
if "l0" not in sys.modules:
20+
_l0 = types.ModuleType("l0")
21+
_l0.calibration = types.ModuleType("l0.calibration")
22+
_l0.calibration.SparseCalibrationWeights = None
23+
sys.modules["l0"] = _l0
24+
sys.modules["l0.calibration"] = _l0.calibration
25+
1426
from policyengine_us_data.utils.randomness import seeded_rng
1527
from policyengine_us_data.utils.takeup import (
1628
SIMPLE_TAKEUP_VARS,

0 commit comments

Comments
 (0)