Files
vitor-aignosi 97bf2fd748
Some checks failed
Quality gate / quality-gate (push) Has been cancelled
SIENTIAPDE-1973
SIENTIAPDE-1973: Refactor unit tests for improved readability, primarily by splitting chained assertions into individual statements and minor fixture import adjustments.
2026-10-29 13:33:25 -03:00

21 lines
557 B
Python

from unittest.mock import AsyncMock, MagicMock
import pytest
@pytest.fixture
def reader_double():
"""Factory of OPC reader doubles holding subscriptions for the given slots.
Like the real ServerReader, `subscriptions` is keyed by slot
and `unsubscribe` drops the slot from it.
"""
def make(*slots):
reader = MagicMock()
reader.subscriptions = {slot: MagicMock() for slot in slots}
reader.unsubscribe = AsyncMock(side_effect=lambda slot: reader.subscriptions.pop(slot))
return reader
return make