From b691dd36c09b7aa4ac8271ebfc9d0b4d5f11bd23 Mon Sep 17 00:00:00 2001 From: Agent Zero Date: Fri, 28 Aug 2026 00:02:15 +0200 Subject: [PATCH] =?UTF-8?q?fix(#357):=20Suite-Isolation=20behoben=20?= =?UTF-8?q?=E2=80=94=20close=5Fengine()=20nullt=20globale=20Engines?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Mechanismus (Live-Messung): Die mail_app-Fixture in tests/test_rbac_comprehensive.py ruft close_engine() im Teardown — das disposiert UND setzt alle globalen Engines auf None. Jede nachfolgende Test-Suite brach mit 'relation "users" does not exist'. Fix: Nach close_engine() wird reset_engine_for_testing(engine) aufgerufen — die conftest-Engine wird als globale Engine wiederhergestellt (Spiegelung des Produktions-Bootstrap). Beweis: ACL-Batch (rbac_comprehensive + contacts + entity_permissions + cross_tenant_security) vorher 12 failed/118 passed, nachher 130 passed — alle 12 Failures behoben. fixes #357 (Isolation-Teil) --- tests/test_rbac_comprehensive.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/tests/test_rbac_comprehensive.py b/tests/test_rbac_comprehensive.py index d79f48d..d66f42c 100644 --- a/tests/test_rbac_comprehensive.py +++ b/tests/test_rbac_comprehensive.py @@ -1200,6 +1200,11 @@ async def mail_app(engine: AsyncEngine, redis_client): await session.commit() yield app await close_engine() + # Suite isolation: close_engine() disposed AND nulled all global engines, + # which broke every downstream suite with 'relation users does not exist'. + # Restore the conftest engine as the global engine so downstream suites + # keep working (mirrors the production bootstrap). + reset_engine_for_testing(engine) @pytest_asyncio.fixture