Alexandre Vassalotti | 30ece44 | 2008-05-11 19:39:48 +0000 | [diff] [blame] | 1 | # Some simple queue module tests, plus some failure conditions |
Tim Peters | afe5297 | 2004-08-20 02:37:25 +0000 | [diff] [blame] | 2 | # to ensure the Queue locks remain stable. |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 3 | import Queue |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 4 | import time |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 5 | import unittest |
| 6 | from test import test_support |
Victor Stinner | 6a10281 | 2010-04-27 23:55:59 +0000 | [diff] [blame] | 7 | threading = test_support.import_module('threading') |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 8 | |
Senthil Kumaran | ce8e33a | 2010-01-08 19:04:16 +0000 | [diff] [blame] | 9 | QUEUE_SIZE = 5 |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 10 | |
Tim Peters | afe5297 | 2004-08-20 02:37:25 +0000 | [diff] [blame] | 11 | # A thread to run a function that unclogs a blocked Queue. |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 12 | class _TriggerThread(threading.Thread): |
| 13 | def __init__(self, fn, args): |
| 14 | self.fn = fn |
| 15 | self.args = args |
| 16 | self.startedEvent = threading.Event() |
| 17 | threading.Thread.__init__(self) |
Tim Peters | afe5297 | 2004-08-20 02:37:25 +0000 | [diff] [blame] | 18 | |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 19 | def run(self): |
Tim Peters | 8d7626c | 2004-08-20 03:27:12 +0000 | [diff] [blame] | 20 | # The sleep isn't necessary, but is intended to give the blocking |
| 21 | # function in the main thread a chance at actually blocking before |
| 22 | # we unclog it. But if the sleep is longer than the timeout-based |
| 23 | # tests wait in their blocking functions, those tests will fail. |
| 24 | # So we give them much longer timeout values compared to the |
| 25 | # sleep here (I aimed at 10 seconds for blocking functions -- |
| 26 | # they should never actually wait that long - they should make |
| 27 | # progress as soon as we call self.fn()). |
| 28 | time.sleep(0.1) |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 29 | self.startedEvent.set() |
| 30 | self.fn(*self.args) |
| 31 | |
Tim Peters | 8d7626c | 2004-08-20 03:27:12 +0000 | [diff] [blame] | 32 | |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 33 | # Execute a function that blocks, and in a separate thread, a function that |
| 34 | # triggers the release. Returns the result of the blocking function. Caution: |
| 35 | # block_func must guarantee to block until trigger_func is called, and |
| 36 | # trigger_func must guarantee to change queue state so that block_func can make |
| 37 | # enough progress to return. In particular, a block_func that just raises an |
| 38 | # exception regardless of whether trigger_func is called will lead to |
| 39 | # timing-dependent sporadic failures, and one of those went rarely seen but |
| 40 | # undiagnosed for years. Now block_func must be unexceptional. If block_func |
| 41 | # is supposed to raise an exception, call do_exceptional_blocking_test() |
| 42 | # instead. |
| 43 | |
| 44 | class BlockingTestMixin: |
| 45 | |
| 46 | def do_blocking_test(self, block_func, block_args, trigger_func, trigger_args): |
| 47 | self.t = _TriggerThread(trigger_func, trigger_args) |
| 48 | self.t.start() |
| 49 | self.result = block_func(*block_args) |
| 50 | # If block_func returned before our thread made the call, we failed! |
Benjamin Peterson | 0fbcf69 | 2008-06-11 17:27:50 +0000 | [diff] [blame] | 51 | if not self.t.startedEvent.is_set(): |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 52 | self.fail("blocking function '%r' appeared not to block" % |
| 53 | block_func) |
| 54 | self.t.join(10) # make sure the thread terminates |
Benjamin Peterson | 0fbcf69 | 2008-06-11 17:27:50 +0000 | [diff] [blame] | 55 | if self.t.is_alive(): |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 56 | self.fail("trigger function '%r' appeared to not return" % |
| 57 | trigger_func) |
| 58 | return self.result |
| 59 | |
| 60 | # Call this instead if block_func is supposed to raise an exception. |
| 61 | def do_exceptional_blocking_test(self,block_func, block_args, trigger_func, |
| 62 | trigger_args, expected_exception_class): |
| 63 | self.t = _TriggerThread(trigger_func, trigger_args) |
| 64 | self.t.start() |
Tim Peters | 8d7626c | 2004-08-20 03:27:12 +0000 | [diff] [blame] | 65 | try: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 66 | try: |
| 67 | block_func(*block_args) |
| 68 | except expected_exception_class: |
| 69 | raise |
| 70 | else: |
| 71 | self.fail("expected exception of kind %r" % |
| 72 | expected_exception_class) |
| 73 | finally: |
| 74 | self.t.join(10) # make sure the thread terminates |
Benjamin Peterson | 0fbcf69 | 2008-06-11 17:27:50 +0000 | [diff] [blame] | 75 | if self.t.is_alive(): |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 76 | self.fail("trigger function '%r' appeared to not return" % |
| 77 | trigger_func) |
Benjamin Peterson | 0fbcf69 | 2008-06-11 17:27:50 +0000 | [diff] [blame] | 78 | if not self.t.startedEvent.is_set(): |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 79 | self.fail("trigger thread ended but event never set") |
| 80 | |
| 81 | |
| 82 | class BaseQueueTest(unittest.TestCase, BlockingTestMixin): |
| 83 | def setUp(self): |
| 84 | self.cum = 0 |
| 85 | self.cumlock = threading.Lock() |
| 86 | |
| 87 | def simple_queue_test(self, q): |
Georg Brandl | 3c3d9ac | 2008-02-06 23:45:51 +0000 | [diff] [blame] | 88 | if not q.empty(): |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 89 | raise RuntimeError, "Call this function with an empty queue" |
| 90 | # I guess we better check things actually queue correctly a little :) |
| 91 | q.put(111) |
| 92 | q.put(333) |
| 93 | q.put(222) |
| 94 | target_order = dict(Queue = [111, 333, 222], |
| 95 | LifoQueue = [222, 333, 111], |
| 96 | PriorityQueue = [111, 222, 333]) |
| 97 | actual_order = [q.get(), q.get(), q.get()] |
Ezio Melotti | 2623a37 | 2010-11-21 13:34:58 +0000 | [diff] [blame] | 98 | self.assertEqual(actual_order, target_order[q.__class__.__name__], |
| 99 | "Didn't seem to queue the correct data!") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 100 | for i in range(QUEUE_SIZE-1): |
| 101 | q.put(i) |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 102 | self.assertTrue(not q.empty(), "Queue should not be empty") |
| 103 | self.assertTrue(not q.full(), "Queue should not be full") |
Ezio Melotti | dde5b94 | 2010-02-03 05:37:26 +0000 | [diff] [blame] | 104 | last = 2 * QUEUE_SIZE |
| 105 | full = 3 * 2 * QUEUE_SIZE |
| 106 | q.put(last) |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 107 | self.assertTrue(q.full(), "Queue should be full") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 108 | try: |
Ezio Melotti | dde5b94 | 2010-02-03 05:37:26 +0000 | [diff] [blame] | 109 | q.put(full, block=0) |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 110 | self.fail("Didn't appear to block with a full queue") |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 111 | except Queue.Full: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 112 | pass |
| 113 | try: |
Ezio Melotti | dde5b94 | 2010-02-03 05:37:26 +0000 | [diff] [blame] | 114 | q.put(full, timeout=0.01) |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 115 | self.fail("Didn't appear to time-out with a full queue") |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 116 | except Queue.Full: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 117 | pass |
| 118 | # Test a blocking put |
Ezio Melotti | dde5b94 | 2010-02-03 05:37:26 +0000 | [diff] [blame] | 119 | self.do_blocking_test(q.put, (full,), q.get, ()) |
| 120 | self.do_blocking_test(q.put, (full, True, 10), q.get, ()) |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 121 | # Empty it |
| 122 | for i in range(QUEUE_SIZE): |
| 123 | q.get() |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 124 | self.assertTrue(q.empty(), "Queue should be empty") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 125 | try: |
| 126 | q.get(block=0) |
| 127 | self.fail("Didn't appear to block with an empty queue") |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 128 | except Queue.Empty: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 129 | pass |
| 130 | try: |
| 131 | q.get(timeout=0.01) |
| 132 | self.fail("Didn't appear to time-out with an empty queue") |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 133 | except Queue.Empty: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 134 | pass |
| 135 | # Test a blocking get |
| 136 | self.do_blocking_test(q.get, (), q.put, ('empty',)) |
| 137 | self.do_blocking_test(q.get, (True, 10), q.put, ('empty',)) |
| 138 | |
| 139 | |
| 140 | def worker(self, q): |
| 141 | while True: |
Georg Brandl | cafb710 | 2008-02-02 23:59:21 +0000 | [diff] [blame] | 142 | x = q.get() |
| 143 | if x is None: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 144 | q.task_done() |
| 145 | return |
Brett Cannon | 4b7deed | 2008-02-03 02:43:01 +0000 | [diff] [blame] | 146 | with self.cumlock: |
Georg Brandl | cafb710 | 2008-02-02 23:59:21 +0000 | [diff] [blame] | 147 | self.cum += x |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 148 | q.task_done() |
| 149 | |
| 150 | def queue_join_test(self, q): |
| 151 | self.cum = 0 |
| 152 | for i in (0,1): |
| 153 | threading.Thread(target=self.worker, args=(q,)).start() |
| 154 | for i in xrange(100): |
| 155 | q.put(i) |
| 156 | q.join() |
Ezio Melotti | 2623a37 | 2010-11-21 13:34:58 +0000 | [diff] [blame] | 157 | self.assertEqual(self.cum, sum(range(100)), |
| 158 | "q.join() did not block until all tasks were done") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 159 | for i in (0,1): |
| 160 | q.put(None) # instruct the threads to close |
| 161 | q.join() # verify that you can join twice |
| 162 | |
| 163 | def test_queue_task_done(self): |
| 164 | # Test to make sure a queue task completed successfully. |
| 165 | q = self.type2test() |
| 166 | try: |
| 167 | q.task_done() |
| 168 | except ValueError: |
| 169 | pass |
Tim Peters | 8d7626c | 2004-08-20 03:27:12 +0000 | [diff] [blame] | 170 | else: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 171 | self.fail("Did not detect task count going negative") |
| 172 | |
| 173 | def test_queue_join(self): |
| 174 | # Test that a queue join()s successfully, and before anything else |
| 175 | # (done twice for insurance). |
| 176 | q = self.type2test() |
| 177 | self.queue_join_test(q) |
| 178 | self.queue_join_test(q) |
| 179 | try: |
| 180 | q.task_done() |
| 181 | except ValueError: |
| 182 | pass |
| 183 | else: |
| 184 | self.fail("Did not detect task count going negative") |
| 185 | |
| 186 | def test_simple_queue(self): |
| 187 | # Do it a couple of times on the same queue. |
| 188 | # Done twice to make sure works with same instance reused. |
| 189 | q = self.type2test(QUEUE_SIZE) |
| 190 | self.simple_queue_test(q) |
| 191 | self.simple_queue_test(q) |
| 192 | |
| 193 | |
| 194 | class QueueTest(BaseQueueTest): |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 195 | type2test = Queue.Queue |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 196 | |
| 197 | class LifoQueueTest(BaseQueueTest): |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 198 | type2test = Queue.LifoQueue |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 199 | |
| 200 | class PriorityQueueTest(BaseQueueTest): |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 201 | type2test = Queue.PriorityQueue |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 202 | |
| 203 | |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 204 | |
| 205 | # A Queue subclass that can provoke failure at a moment's notice :) |
| 206 | class FailingQueueException(Exception): |
| 207 | pass |
| 208 | |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 209 | class FailingQueue(Queue.Queue): |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 210 | def __init__(self, *args): |
| 211 | self.fail_next_put = False |
| 212 | self.fail_next_get = False |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 213 | Queue.Queue.__init__(self, *args) |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 214 | def _put(self, item): |
| 215 | if self.fail_next_put: |
| 216 | self.fail_next_put = False |
| 217 | raise FailingQueueException, "You Lose" |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 218 | return Queue.Queue._put(self, item) |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 219 | def _get(self): |
| 220 | if self.fail_next_get: |
| 221 | self.fail_next_get = False |
| 222 | raise FailingQueueException, "You Lose" |
Georg Brandl | a6168f9 | 2008-05-25 07:20:14 +0000 | [diff] [blame] | 223 | return Queue.Queue._get(self) |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 224 | |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 225 | class FailingQueueTest(unittest.TestCase, BlockingTestMixin): |
Mark Hammond | 3b959db | 2002-04-19 00:11:32 +0000 | [diff] [blame] | 226 | |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 227 | def failing_queue_test(self, q): |
Georg Brandl | 3c3d9ac | 2008-02-06 23:45:51 +0000 | [diff] [blame] | 228 | if not q.empty(): |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 229 | raise RuntimeError, "Call this function with an empty queue" |
| 230 | for i in range(QUEUE_SIZE-1): |
| 231 | q.put(i) |
| 232 | # Test a failing non-blocking put. |
| 233 | q.fail_next_put = True |
Raymond Hettinger | fd3fcf0 | 2006-03-24 20:43:29 +0000 | [diff] [blame] | 234 | try: |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 235 | q.put("oops", block=0) |
| 236 | self.fail("The queue didn't fail when it should have") |
| 237 | except FailingQueueException: |
| 238 | pass |
| 239 | q.fail_next_put = True |
| 240 | try: |
| 241 | q.put("oops", timeout=0.1) |
| 242 | self.fail("The queue didn't fail when it should have") |
| 243 | except FailingQueueException: |
| 244 | pass |
| 245 | q.put("last") |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 246 | self.assertTrue(q.full(), "Queue should be full") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 247 | # Test a failing blocking put |
| 248 | q.fail_next_put = True |
| 249 | try: |
| 250 | self.do_blocking_test(q.put, ("full",), q.get, ()) |
| 251 | self.fail("The queue didn't fail when it should have") |
| 252 | except FailingQueueException: |
| 253 | pass |
| 254 | # Check the Queue isn't damaged. |
| 255 | # put failed, but get succeeded - re-add |
| 256 | q.put("last") |
| 257 | # Test a failing timeout put |
| 258 | q.fail_next_put = True |
| 259 | try: |
| 260 | self.do_exceptional_blocking_test(q.put, ("full", True, 10), q.get, (), |
| 261 | FailingQueueException) |
| 262 | self.fail("The queue didn't fail when it should have") |
| 263 | except FailingQueueException: |
| 264 | pass |
| 265 | # Check the Queue isn't damaged. |
| 266 | # put failed, but get succeeded - re-add |
| 267 | q.put("last") |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 268 | self.assertTrue(q.full(), "Queue should be full") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 269 | q.get() |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 270 | self.assertTrue(not q.full(), "Queue should not be full") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 271 | q.put("last") |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 272 | self.assertTrue(q.full(), "Queue should be full") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 273 | # Test a blocking put |
| 274 | self.do_blocking_test(q.put, ("full",), q.get, ()) |
| 275 | # Empty it |
| 276 | for i in range(QUEUE_SIZE): |
| 277 | q.get() |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 278 | self.assertTrue(q.empty(), "Queue should be empty") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 279 | q.put("first") |
| 280 | q.fail_next_get = True |
| 281 | try: |
| 282 | q.get() |
| 283 | self.fail("The queue didn't fail when it should have") |
| 284 | except FailingQueueException: |
| 285 | pass |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 286 | self.assertTrue(not q.empty(), "Queue should not be empty") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 287 | q.fail_next_get = True |
| 288 | try: |
| 289 | q.get(timeout=0.1) |
| 290 | self.fail("The queue didn't fail when it should have") |
| 291 | except FailingQueueException: |
| 292 | pass |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 293 | self.assertTrue(not q.empty(), "Queue should not be empty") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 294 | q.get() |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 295 | self.assertTrue(q.empty(), "Queue should be empty") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 296 | q.fail_next_get = True |
| 297 | try: |
| 298 | self.do_exceptional_blocking_test(q.get, (), q.put, ('empty',), |
| 299 | FailingQueueException) |
| 300 | self.fail("The queue didn't fail when it should have") |
| 301 | except FailingQueueException: |
| 302 | pass |
| 303 | # put succeeded, but get failed. |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 304 | self.assertTrue(not q.empty(), "Queue should not be empty") |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 305 | q.get() |
Benjamin Peterson | 5c8da86 | 2009-06-30 22:57:08 +0000 | [diff] [blame] | 306 | self.assertTrue(q.empty(), "Queue should be empty") |
Tim Peters | e33901e | 2006-03-25 01:50:43 +0000 | [diff] [blame] | 307 | |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 308 | def test_failing_queue(self): |
| 309 | # Test to make sure a queue is functioning correctly. |
| 310 | # Done twice to the same instance. |
| 311 | q = FailingQueue(QUEUE_SIZE) |
| 312 | self.failing_queue_test(q) |
| 313 | self.failing_queue_test(q) |
Raymond Hettinger | c4e94b9 | 2006-03-25 12:15:04 +0000 | [diff] [blame] | 314 | |
Raymond Hettinger | fd3fcf0 | 2006-03-24 20:43:29 +0000 | [diff] [blame] | 315 | |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 316 | def test_main(): |
| 317 | test_support.run_unittest(QueueTest, LifoQueueTest, PriorityQueueTest, |
| 318 | FailingQueueTest) |
Raymond Hettinger | fd3fcf0 | 2006-03-24 20:43:29 +0000 | [diff] [blame] | 319 | |
Raymond Hettinger | 9e1bc98 | 2008-01-16 23:40:45 +0000 | [diff] [blame] | 320 | |
Georg Brandl | d22b466 | 2008-02-02 11:39:29 +0000 | [diff] [blame] | 321 | if __name__ == "__main__": |
| 322 | test_main() |