diff --git a/tests/unit/strategy/test_population_module.py b/tests/unit/strategy/test_population_module.py index d7f4e21..c406c18 100644 --- a/tests/unit/strategy/test_population_module.py +++ b/tests/unit/strategy/test_population_module.py @@ -27,9 +27,11 @@ def test_from_env_defaults_match_production_keys(): assert cfg.squeeze_rvol_min == 5.0 -def test_from_env_bare_shell_disables_gap_gate(): - # No production env => min_entry_gap_pct clamps to 0.0 (gap gate off), the - # exact hazard the plan warns offline consumers about. +def test_from_env_bare_shell_disables_gap_gate(monkeypatch): + # No production env => min_entry_gap_pct defaults to 0.0 (gap gate off), the + # exact hazard the plan warns offline consumers about. (from_env merges + # os.environ, which .env-loading imports populate — so we clear the key.) + monkeypatch.delenv("TRADING_MIN_ENTRY_GAP_PCT", raising=False) cfg = PopulationConfig.from_env(env={}) assert cfg.min_entry_gap_pct == 0.0 assert population_reject(cfg, gap_pct=0.05, price=10.0, volume=None, rvol=None) is None