diff --git a/tests/unit/connectors/test_connectorDbPostgre_pool.py b/tests/unit/connectors/test_connectorDbPostgre_pool.py index bb4170e9..99dbab43 100644 --- a/tests/unit/connectors/test_connectorDbPostgre_pool.py +++ b/tests/unit/connectors/test_connectorDbPostgre_pool.py @@ -41,6 +41,7 @@ import psycopg2.errors import pytest from pydantic import Field +import modules.connectors.connectorDbPostgre as _pgmod from modules.connectors.connectorDbPostgre import ( DatabaseConnector, _PoolRegistry, @@ -149,6 +150,7 @@ def liveConnector(): adminConn.close() closeAllPools() + _pgmod._shuttingDown = False connector = DatabaseConnector( dbHost=host, @@ -164,6 +166,7 @@ def liveConnector(): # Teardown: tear pools down, then drop the DB. closeAllPools() + _pgmod._shuttingDown = False adminConn = psycopg2.connect( host=host, port=port, database="postgres", user=user, password=password ) diff --git a/tests/unit/services/test_buildTree.py b/tests/unit/services/test_buildTree.py index d285e867..1f8c8da0 100644 --- a/tests/unit/services/test_buildTree.py +++ b/tests/unit/services/test_buildTree.py @@ -127,7 +127,9 @@ class TestGetChildrenForParents(unittest.TestCase): self.assertEqual(result["bogus|key"], []) def test_top_level_emits_personal_root_first(self): - with patch("modules.interfaces.interfaceDbApp.getRootInterface") as mockRoot: + with patch("modules.interfaces.interfaceDbApp.getRootInterface") as mockRoot, \ + patch("modules.serviceCenter.services.serviceKnowledge._buildTree._personalRootChildrenNodes", return_value=[]), \ + patch("modules.security.rbacCatalog.getCatalogService"): rootIf = MagicMock() rootIf.db.getRecordset.return_value = [] rootIf.getUserMandates.return_value = [] @@ -151,7 +153,8 @@ class TestGetChildrenForParents(unittest.TestCase): def test_top_level_emits_mandate_groups_inline(self): with patch("modules.interfaces.interfaceDbApp.getRootInterface") as mockRoot, \ - patch("modules.security.rbacCatalog.getCatalogService") as mockCatalog: + patch("modules.security.rbacCatalog.getCatalogService") as mockCatalog, \ + patch("modules.serviceCenter.services.serviceKnowledge._buildTree._personalRootChildrenNodes", return_value=[]): rootIf = MagicMock() rootIf.db.getRecordset.return_value = [] userMandate = MagicMock() diff --git a/tests/unit/services/test_featureDataAgent_schema.py b/tests/unit/services/test_featureDataAgent_schema.py index 616f46cc..2b84e08c 100644 --- a/tests/unit/services/test_featureDataAgent_schema.py +++ b/tests/unit/services/test_featureDataAgent_schema.py @@ -20,7 +20,7 @@ asked for the closing balance per period). from __future__ import annotations import asyncio -from unittest.mock import MagicMock +from unittest.mock import AsyncMock, MagicMock import pytest @@ -228,6 +228,7 @@ def _buildRegistryWithMockProvider(): provider.browseTable.return_value = {"rows": [], "total": 0, "limit": 50, "offset": 0} provider.queryTable.return_value = {"rows": [], "total": 0, "limit": 50, "offset": 0} provider.aggregateTable.return_value = {"rows": [], "aggregate": "SUM", "field": "x"} + provider.finalizeRowsAsync = AsyncMock(return_value=[]) registry = _buildSubAgentTools( provider=provider, featureInstanceId="fi-test",