mirror of
https://github.com/TauricResearch/TradingAgents.git
synced 2026-07-02 04:34:28 +03:00
test: make the API-key fixture robust to empty-string env vars
A key left blank in a .env (var present but empty) bypassed the placeholder, so local runs diverged from CI. Use 'or' instead of a .get default.
This commit is contained in:
@@ -32,7 +32,9 @@ _API_KEY_ENV_VARS = (
|
|||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
def _dummy_api_keys(monkeypatch):
|
def _dummy_api_keys(monkeypatch):
|
||||||
for env_var in _API_KEY_ENV_VARS:
|
for env_var in _API_KEY_ENV_VARS:
|
||||||
monkeypatch.setenv(env_var, os.environ.get(env_var, "placeholder"))
|
# `or` not a .get default: an env var present but empty (e.g. a key left
|
||||||
|
# blank in a .env copied from .env.example) must still get the placeholder.
|
||||||
|
monkeypatch.setenv(env_var, os.environ.get(env_var) or "placeholder")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(autouse=True)
|
@pytest.fixture(autouse=True)
|
||||||
|
|||||||
Reference in New Issue
Block a user