From a79171ee4a4ba9437a49dc9eaed1d8fbb9926e92 Mon Sep 17 00:00:00 2001 From: Franccesco Orozco Date: Thu, 24 Sep 2026 11:34:46 -0600 Subject: [PATCH] test: isolate no-key config tests from local config file TestConfiguration::test_client_raises_without_key and test_whitespace_only_api_key_rejected now patch Configuration._load_api_key to return None, so a key stored in ~/.bloomy/config.yaml no longer makes them fail with "DID NOT RAISE ConfigurationError". Co-Authored-By: Claude Opus 5.5 (1M context) --- tests/test_integration_users.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/test_integration_users.py b/tests/test_integration_users.py index eb38b6c..4c1cc01 100644 --- a/tests/test_integration_users.py +++ b/tests/test_integration_users.py @@ -97,6 +97,7 @@ def test_client_raises_without_key(self, monkeypatch: pytest.MonkeyPatch) -> Non """Client should raise ConfigurationError when no API key exists.""" monkeypatch.delenv("BG_API_KEY", raising=False) # Patch _load_api_key to ensure no config file fallback + monkeypatch.setattr(Configuration, "_load_api_key", lambda _self: None) with pytest.raises(ConfigurationError): Client(api_key=None) @@ -105,6 +106,7 @@ def test_whitespace_only_api_key_rejected( ) -> None: """Whitespace-only API key should be rejected by Client.""" monkeypatch.delenv("BG_API_KEY", raising=False) + monkeypatch.setattr(Configuration, "_load_api_key", lambda _self: None) with pytest.raises(ConfigurationError): Client(api_key=" ")