Rename Queue module to queue.

Updated documentation to use new name.
Merged revisions 63077 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk

........
  r63077 | alexandre.vassalotti | 2008-05-11 15:39:48 -0400 (Sun, 11 May 2008) | 3 lines

  Added stub for the Queue module to be renamed in 3.0.
  Use the 3.0 module name to avoid spurious warnings.
........
This commit is contained in:
Alexandre Vassalotti 2008-05-11 19:59:59 +00:00
parent 4e3e21e2cf
commit f260e443ac
12 changed files with 49 additions and 33 deletions

View file

@ -1,6 +1,6 @@
# Some simple Queue module tests, plus some failure conditions
# Some simple queue module tests, plus some failure conditions
# to ensure the Queue locks remain stable.
import Queue
import queue
import sys
import threading
import time
@ -112,12 +112,12 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
try:
q.put(full, block=0)
self.fail("Didn't appear to block with a full queue")
except Queue.Full:
except queue.Full:
pass
try:
q.put(full, timeout=0.01)
self.fail("Didn't appear to time-out with a full queue")
except Queue.Full:
except queue.Full:
pass
# Test a blocking put
self.do_blocking_test(q.put, (full,), q.get, ())
@ -129,12 +129,12 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
try:
q.get(block=0)
self.fail("Didn't appear to block with an empty queue")
except Queue.Empty:
except queue.Empty:
pass
try:
q.get(timeout=0.01)
self.fail("Didn't appear to time-out with an empty queue")
except Queue.Empty:
except queue.Empty:
pass
# Test a blocking get
self.do_blocking_test(q.get, (), q.put, ('empty',))
@ -196,13 +196,13 @@ class BaseQueueTest(unittest.TestCase, BlockingTestMixin):
class QueueTest(BaseQueueTest):
type2test = Queue.Queue
type2test = queue.Queue
class LifoQueueTest(BaseQueueTest):
type2test = Queue.LifoQueue
type2test = queue.LifoQueue
class PriorityQueueTest(BaseQueueTest):
type2test = Queue.PriorityQueue
type2test = queue.PriorityQueue
@ -210,21 +210,21 @@ class PriorityQueueTest(BaseQueueTest):
class FailingQueueException(Exception):
pass
class FailingQueue(Queue.Queue):
class FailingQueue(queue.Queue):
def __init__(self, *args):
self.fail_next_put = False
self.fail_next_get = False
Queue.Queue.__init__(self, *args)
queue.Queue.__init__(self, *args)
def _put(self, item):
if self.fail_next_put:
self.fail_next_put = False
raise FailingQueueException("You Lose")
return Queue.Queue._put(self, item)
return queue.Queue._put(self, item)
def _get(self):
if self.fail_next_get:
self.fail_next_get = False
raise FailingQueueException("You Lose")
return Queue.Queue._get(self)
return queue.Queue._get(self)
class FailingQueueTest(unittest.TestCase, BlockingTestMixin):