Skip to content

Commit 8ab24f3

Browse files
committed
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.
1 parent 2b2d685 commit 8ab24f3

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

tests/conftest.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,9 @@ def pytest_configure(config):
3232
@pytest.fixture(autouse=True)
3333
def _dummy_api_keys(monkeypatch):
3434
for env_var in _API_KEY_ENV_VARS:
35-
monkeypatch.setenv(env_var, os.environ.get(env_var, "placeholder"))
35+
# `or` not a .get default: an env var present but empty (e.g. a key left
36+
# blank in a .env copied from .env.example) must still get the placeholder.
37+
monkeypatch.setenv(env_var, os.environ.get(env_var) or "placeholder")
3638

3739

3840
@pytest.fixture(autouse=True)

0 commit comments

Comments
 (0)