Fix Portainer tests hanging on real event listener (#180464)

This commit is contained in:
TheJulianJES
2026-08-28 06:35:56 +02:00
committed by GitHub
parent c923b497be
commit 5b6aecf5d7
+6 -2
View File
@@ -139,9 +139,13 @@ def mock_portainer_client(mock_portainer_watcher: MagicMock) -> Generator[AsyncM
yield client
@pytest.fixture
@pytest.fixture(autouse=True)
def mock_portainer_event_listeners() -> Generator[dict[int, MagicMock]]:
"""Mock PortainerEventListener; one MagicMock instance per endpoint_id."""
"""Mock PortainerEventListener; one MagicMock instance per endpoint_id.
Autouse because the real listener reconnects in a tight loop when its
event stream ends immediately, as the mocked client's does.
"""
instances: dict[int, MagicMock] = {}
def _factory(