You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For Cabbage to be used in a real codebase, we'll need a few tools that will make testability easier:
A pluggable in-memory list of created tasks
A way to launch these task synchronously
A way to launch a single task
I'm thinking something along the lines of:
fromcabbage.testingimportTestTaskManagertm=TestTaskManager()
something= []
@tm.task(queue="yay")deft(task_run, a):
something.append(a)
t.defer(a=1)
# A pluggable in-memory list of created tasksasserttm.scheduled== [{"name": "t", "args": {"a": 1}]
# A way to launch these task synchronouslytm.run_scheduled()
assertsomething== [1]
# A way to launch a single taskt.run(a=2)
assertsomething== [1, 2]
(For now, no idea how we'd substitute the TaskManager with the TestTaskManager in a real case, but we can think of something)
The text was updated successfully, but these errors were encountered:
For Cabbage to be used in a real codebase, we'll need a few tools that will make testability easier:
I'm thinking something along the lines of:
(For now, no idea how we'd substitute the TaskManager with the TestTaskManager in a real case, but we can think of something)
The text was updated successfully, but these errors were encountered: