From 3384c049a4bba6b40134c77fceb80ef3f5210d2d Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Wed, 10 Aug 2022 11:10:22 -0400 Subject: [PATCH] UT: Use new Publisher for each test instead of default `pub` Using the default publisher provided by pypubsub causes state to be carried over between tests. Unit tests should not depend on eachother or the order in which they're run. --- .../common/event_queue/test_pypubsub_event_queue.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/monkey/tests/unit_tests/common/event_queue/test_pypubsub_event_queue.py b/monkey/tests/unit_tests/common/event_queue/test_pypubsub_event_queue.py index f47a80fe2..1bd919133 100644 --- a/monkey/tests/unit_tests/common/event_queue/test_pypubsub_event_queue.py +++ b/monkey/tests/unit_tests/common/event_queue/test_pypubsub_event_queue.py @@ -4,7 +4,7 @@ from typing import FrozenSet, Union from uuid import UUID import pytest -from pubsub import pub +from pubsub.core import Publisher from common.event_queue.pypubsub_event_queue import PyPubSubEventQueue from common.events import AbstractEvent @@ -49,7 +49,7 @@ def subscriber(): @pytest.fixture def event_queue(): - return PyPubSubEventQueue(pub) + return PyPubSubEventQueue(Publisher()) def test_subscribe_all(event_queue, subscriber):