Skip to content

Commit b2b9227

Browse files
committed
fix(test_config): Update coerce_float tests to ensure correct behavior after cache clear
1 parent 96d15d1 commit b2b9227

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

tests/unit/test_config.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,18 +28,21 @@ def test_runtime_coerce_float_inverted_flag(monkeypatch):
2828

2929

3030
def test_coerce_float_picks_up_late_env_after_cache_clear(monkeypatch):
31-
# Config cached before DEEPNOTE_DO_NOT_COERCE_FLOAT is set → stale.
32-
# After clear_config_cache(), next get_config() sees the new value.
31+
# Setup: start from a clean cache and confirm the default value
3332
clear_config_cache()
3433
monkeypatch.delenv("DEEPNOTE_DO_NOT_COERCE_FLOAT", raising=False)
34+
cfg_default = get_config()
35+
assert cfg_default.runtime.coerce_float is True
3536

36-
assert get_config().runtime.coerce_float is True
37-
37+
# Inject the env var; the cached config should still return the default
3838
monkeypatch.setenv("DEEPNOTE_DO_NOT_COERCE_FLOAT", "1")
39-
assert get_config().runtime.coerce_float is True # stale
39+
cfg_cached = get_config()
40+
assert cfg_cached.runtime.coerce_float is True
4041

42+
# After clearing the cache, the config should pick up the injected value
4143
clear_config_cache()
42-
assert get_config().runtime.coerce_float is False
44+
cfg_refreshed = get_config()
45+
assert cfg_refreshed.runtime.coerce_float is False
4346

4447

4548
def test_loader_precedence_cli_over_env_over_file(tmp_path, monkeypatch):

0 commit comments

Comments
 (0)