Skip to content

Commit 3312a12

Browse files
committed
refactor: configures in memory broker for testing REFS #73
1 parent da979a9 commit 3312a12

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/labs/broker.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,14 @@
5757
],
5858
)
5959

60+
# For testing we use the InMemory broker, this is set
61+
# if an environment variables is set, please note you
62+
# will require pytest-env for environment vars to work
63+
env = os.environ.get("ENVIRONMENT")
64+
if env and env == "pytest":
65+
from taskiq import InMemoryBroker
66+
broker = InMemoryBroker()
67+
6068
# The middleware is used to inject the broker into FastAPI
6169
# it enables broker task discovery for FastAPI applications
6270
# as well as sharing dependencies between tasks and FastAPI

0 commit comments

Comments
 (0)