From 8ab24f30aff9897c5cc59b2f028264d08652af49 Mon Sep 17 00:00:00 2001 From: Yijia-Xiao Date: Sun, 21 Jun 2026 23:50:33 +0000 Subject: [PATCH] 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. --- tests/conftest.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/conftest.py b/tests/conftest.py index 6930599a7..5b865952f 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -32,7 +32,9 @@ _API_KEY_ENV_VARS = ( @pytest.fixture(autouse=True) def _dummy_api_keys(monkeypatch): 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)