File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import importlib .util
22import json
33import os
4+ import sys
45import tempfile
6+ import types
57import unittest
68from pathlib import Path
79from unittest import mock
@@ -107,18 +109,25 @@ def test_health_cycle_skips_issue_creation_when_drift_is_unavailable(self) -> No
107109 def test_daily_briefing_marks_missing_dashboard_unavailable (self ) -> None :
108110 with tempfile .TemporaryDirectory () as tmp :
109111 root = Path (tmp )
112+ qpk = types .ModuleType ("quant_platform_kit" )
113+ lifecycle = types .ModuleType ("quant_platform_kit.strategy_lifecycle" )
114+ drift_detector = types .ModuleType ("quant_platform_kit.strategy_lifecycle.drift_detector" )
115+ health_dashboard = types .ModuleType ("quant_platform_kit.strategy_lifecycle.health_dashboard" )
116+ drift_detector .run_drift_detection = lambda _domain : []
117+ health_dashboard .build_dashboard = lambda ** _kwargs : None
110118 with (
111119 mock .patch .dict (
112120 os .environ ,
113121 {"QUANT_MONITOR_ROOT" : str (root ), "DAY" : "2026-07-30" },
114122 ),
115- mock .patch (
116- "quant_platform_kit.strategy_lifecycle.drift_detector.run_drift_detection" ,
117- return_value = [],
118- ),
119- mock .patch (
120- "quant_platform_kit.strategy_lifecycle.health_dashboard.build_dashboard" ,
121- return_value = None ,
123+ mock .patch .dict (
124+ sys .modules ,
125+ {
126+ "quant_platform_kit" : qpk ,
127+ "quant_platform_kit.strategy_lifecycle" : lifecycle ,
128+ "quant_platform_kit.strategy_lifecycle.drift_detector" : drift_detector ,
129+ "quant_platform_kit.strategy_lifecycle.health_dashboard" : health_dashboard ,
130+ },
122131 ),
123132 ):
124133 self .assertEqual (DAILY_BRIEFING .main (), 0 )
You can’t perform that action at this time.
0 commit comments