comparison test/memcached.py @ 1:32222d11961f

Initial commit with two tested backends: memcached protocol and Amazon SQS. Because of the non-guaranteed nature of SQS queues, some tests may fail even though the library is working properly.
author mcroydon
date Thu, 08 Jan 2009 07:49:35 +0000
parents
children
comparison
equal deleted inserted replaced
0:17e60d0dfb44 1:32222d11961f
1 """
2 Test basic queue functionality
3
4 >>> from queues import queues
5 >>> import datetime
6 >>> queue_name = 'test_queues_%s' % datetime.datetime.now().isoformat()
7
8 Verify that the queue does not exist
9 >>> queue_name in queues.get_list()
10 False
11
12 Create the queue
13 >>> q = queues.Queue(queue_name)
14
15 Write to the queue
16 >>> q.write('test')
17 True
18
19 Verify that it is indeed in the list
20 >>> queue_name in queues.get_list()
21 True
22
23 Get the length of the queue
24 >>> len(q)
25 1
26
27 Read from the queue
28 >>> q.read()
29 'test'
30
31 The queue should now be empty
32 >>> len(q)
33 0
34
35 TODO: get rid of the queue?
36 """
37
38 if __name__ == "__main__":
39 import doctest
40 doctest.testmod()