本文整理汇总了Python中aiorq.Queue.all方法的典型用法代码示例。如果您正苦于以下问题:Python Queue.all方法的具体用法?Python Queue.all怎么用?Python Queue.all使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类aiorq.Queue
的用法示例。
在下文中一共展示了Queue.all方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_all_queues
# 需要导入模块: from aiorq import Queue [as 别名]
# 或者: from aiorq.Queue import all [as 别名]
def test_all_queues():
"""All queues"""
q1 = Queue('first-queue')
q2 = Queue('second-queue')
q3 = Queue('third-queue')
# Ensure a queue is added only once a job is enqueued
assert not len((yield from Queue.all()))
yield from q1.enqueue(say_hello)
assert len((yield from Queue.all())) == 1
# Ensure this holds true for multiple queues
yield from q2.enqueue(say_hello)
yield from q3.enqueue(say_hello)
names = [q.name for q in (yield from Queue.all())]
assert len((yield from Queue.all())) == 3
# Verify names
assert 'first-queue' in names
assert 'second-queue' in names
assert 'third-queue' in names
# Now empty two queues
with SynchronousConnection():
w = SynchronousWorker([SynchronousQueue('second-queue'),
SynchronousQueue('third-queue')])
w.work(burst=True)
# Queue.all() should still report the empty queues
assert len((yield from Queue.all())) == 3