population test: clear env for the bare-shell from_env case
from_env merges os.environ, and importing the .env-loading consumers populates TRADING_MIN_ENTRY_GAP_PCT — so the "bare shell disables the gap gate" assertion must delenv the key first. Test-only fix; the module behaviour is unchanged. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
3e2d690b21
commit
5518625bbb
1 file changed
+5
-3
@@ -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
|
||||
|
||||
Reference in new issue
Block a user