From ed8709fde1539a787467246d457364eb08d1f94e Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 27 Aug 2026 19:56:53 +0000 Subject: [PATCH] Fix Postgres CI: in-memory API key store test must not use import singleton. The live Postgres job sets NETLOGIC_DATABASE_URL before pytest imports api_keys, so api_key_store is already PgApiKeyStore. Assert the builder after clearing the env instead. Co-authored-by: dmitryflynn --- test_db.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test_db.py b/test_db.py index bb3b277..c5222d5 100644 --- a/test_db.py +++ b/test_db.py @@ -29,8 +29,8 @@ def test_provisioning_noop_when_disabled(monkeypatch): def test_api_key_store_in_memory_without_db(monkeypatch): - # The process singleton was built at import time (no DB) → in-memory. - assert isinstance(api_keys.api_key_store, api_keys.ApiKeyStore) + # Builder choice follows the env at call time. The process singleton may + # already be Postgres if this file ran in a job that set DATABASE_URL. monkeypatch.delenv("NETLOGIC_DATABASE_URL", raising=False) assert isinstance(api_keys._build_api_key_store(), api_keys.ApiKeyStore)