Python
test: make the API-key fixture robust to empty-string env vars
Yijia-Xiao8ab24f30aff9
diff --git a/tests/conftest.py b/tests/conftest.pyindex 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)