Mercurial > public > queues
changeset 20:b4184f99ed13
Added functionality for the dummy backend to make it behave more like a production backend for testability sake. Thanks to Travis Cline for the patch. Fixes issue #4.
author | mcroydon |
---|---|
date | Tue, 20 Oct 2009 22:01:12 +0000 |
parents | b2af7123f5e3 |
children | 331d96e6a133 |
files | queues/backends/dummy.py |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/queues/backends/dummy.py Wed Sep 16 15:03:15 2009 +0000 +++ b/queues/backends/dummy.py Tue Oct 20 22:01:12 2009 +0000 @@ -7,13 +7,16 @@ from queues import QueueException from queues.backends.base import BaseQueue +queues = {} -dummy_queue = queue.Queue() - +def get_queue(name): + if name not in queues: + queues[name] = queue.Queue() + return queues[name] class Queue(BaseQueue): def __init__(self, name='default'): - self.queue = dummy_queue + self.queue = get_queue(name) self.backend = 'dummy' self.name = name