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.
This commit is contained in:
Mike Salvatore 2022-08-10 11:10:22 -04:00
parent 68dafbfb9d
commit 3384c049a4
1 changed files with 2 additions and 2 deletions

View File

@ -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):