fix(ocr): handle empty-string HTRMOPO_DIR env var with or-fallback
os.environ.get(key, default) returns "" when the key exists but is blank — the default is only used when the key is absent. The or-fallback treats both absence and blank values as "use the default". Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -29,6 +29,15 @@ def test_htrmopo_dir_default_is_fixed_path():
|
||||
assert result == "/app/models/.htrmopo"
|
||||
|
||||
|
||||
def test_htrmopo_dir_falls_back_to_default_when_set_to_empty_string():
|
||||
"""HTRMOPO_DIR='' must not produce an empty path — get() returns '' for blank env vars."""
|
||||
with patch.dict(os.environ, {"HTRMOPO_DIR": ""}):
|
||||
importlib.reload(ensure_blla_model)
|
||||
result = ensure_blla_model.HTRMOPO_DIR
|
||||
importlib.reload(ensure_blla_model)
|
||||
assert result != ""
|
||||
|
||||
|
||||
# ─── Model already loadable ───────────────────────────────────────────────────
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user