From 07c7bd4c8bc2f1d0a9eb51e78525cff6a4a2294f Mon Sep 17 00:00:00 2001 From: ZdenekSrotyr Date: Fri, 1 May 2026 23:27:59 +0200 Subject: [PATCH] fix(test): reset instance_config cache in TestRebuildFromRegistry leakage repair MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit CI on dc03837a showed test_missing_project_returns_error failing with 'ok-project' instead of '' — config-cache leak from the sibling test_returns_skipped_when_no_bq_rows that ran first under pytest-xdist. Pre-existing flake (cache lives in app.instance_config; monkeypatch restores the loader patch but doesn't invalidate the cached return). Earlier CI runs (a4339ce6) got lucky on test ordering. Adding an explicit reset_cache() at the top of the test removes the dependency on ordering. --- tests/test_admin_bq_register.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/test_admin_bq_register.py b/tests/test_admin_bq_register.py index c862f31..afe7d24 100644 --- a/tests/test_admin_bq_register.py +++ b/tests/test_admin_bq_register.py @@ -705,6 +705,13 @@ class TestRebuildFromRegistry: assert "orders" in names def test_missing_project_returns_error(self, e2e_env, monkeypatch): + # Reset the instance-config cache so a sibling test's patched + # `bigquery: {project: "ok-project"}` doesn't leak into this one's + # `bigquery: {}` view. The cache is keyed on the loader's first + # call, not on monkeypatch's restore — so monkeypatch.setattr alone + # isn't sufficient. + from app.instance_config import reset_cache + reset_cache() monkeypatch.setattr( "config.loader.load_instance_config", lambda: {"data_source": {"type": "bigquery", "bigquery": {}}},