UT: Replace fn() with SubscriberSpy callable

This commit is contained in:
Mike Salvatore 2022-09-06 12:59:22 -04:00
parent e1e119c27a
commit 59c58b3115
1 changed files with 7 additions and 6 deletions

View File

@ -19,14 +19,15 @@ def event_queue() -> IIslandEventQueue:
@pytest.fixture @pytest.fixture
def event_queue_subscriber() -> Callable[..., None]: def event_queue_subscriber() -> Callable[..., None]:
def fn(topic=pub.AUTO_TOPIC): class SubscriberSpy:
fn.call_count += 1 call_count = 0
fn.call_topics |= {topic.getName()} call_topics = set()
fn.call_count = 0 def __call__(self, topic=pub.AUTO_TOPIC):
fn.call_topics = set() self.call_count += 1
self.call_topics |= {topic.getName()}
return fn return SubscriberSpy()
def test_subscribe_publish__no_event_body( def test_subscribe_publish__no_event_body(