diff options
| author | Gordon Sim <gsim@apache.org> | 2007-02-09 13:44:08 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2007-02-09 13:44:08 +0000 |
| commit | 521b63e9ad416df5cd98c65aa0246efbc24b7503 (patch) | |
| tree | ce2cb3ca2ed6b49faa80dd0c2945db647d0bfb1b /python | |
| parent | 8cf4a0b8ebaa6075a1f083a294b1fee90bd4d196 (diff) | |
| download | qpid-python-521b63e9ad416df5cd98c65aa0246efbc24b7503.tar.gz | |
* qpid/peer.py - fix to prevent race between handling of connection.close request and socket close
* qpid/testlib.py - close client (if not closed) on tearDown
* tests/basic.py - revert back to using exclusive queue which should now be cleaned up on tear down
* tests/message.py - fix to prefetch tests
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/branches/qpid.0-9@505287 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'python')
| -rw-r--r-- | python/qpid/peer.py | 4 | ||||
| -rw-r--r-- | python/qpid/testlib.py | 4 | ||||
| -rw-r--r-- | python/tests/basic.py | 2 | ||||
| -rw-r--r-- | python/tests/message.py | 9 |
4 files changed, 12 insertions, 7 deletions
diff --git a/python/qpid/peer.py b/python/qpid/peer.py index 3c60d99f9a..9f9644f17d 100644 --- a/python/qpid/peer.py +++ b/python/qpid/peer.py @@ -89,7 +89,7 @@ class Peer: try: frame = self.conn.read() except EOF, e: - self.close(e) + self.work.close() break ch = self.channel(frame.channel) ch.receive(frame, self.work) @@ -126,6 +126,8 @@ class Peer: content = None self.delegate(channel, Message(channel, frame, content)) + except QueueClosed, e: + self.close(e) except: self.fatal() diff --git a/python/qpid/testlib.py b/python/qpid/testlib.py index 9f2f0d08d5..836315a4e3 100644 --- a/python/qpid/testlib.py +++ b/python/qpid/testlib.py @@ -171,6 +171,10 @@ class TestBase(unittest.TestCase): for ch, ex in self.exchanges: ch.exchange_delete(exchange=ex) + if not self.client.closed: + self.client.channel(0).connection_close(reply_code=200) + del self.client + def connect(self, *args, **keys): """Create a new connction, return the Client object""" return testrunner.connect(*args, **keys) diff --git a/python/tests/basic.py b/python/tests/basic.py index 0100b8ee3e..140576540a 100644 --- a/python/tests/basic.py +++ b/python/tests/basic.py @@ -147,7 +147,7 @@ class BasicTests(TestBase): Test basic ack/recover behaviour """ channel = self.channel - self.queue_declare(queue="test-ack-queue", exclusive=True) + channel.queue_declare(queue="test-ack-queue", exclusive=True) reply = channel.basic_consume(queue="test-ack-queue", no_ack=False) queue = self.client.queue(reply.consumer_tag) diff --git a/python/tests/message.py b/python/tests/message.py index 3c52c2d03c..df621ff295 100644 --- a/python/tests/message.py +++ b/python/tests/message.py @@ -277,7 +277,7 @@ class MessageTests(TestBase): #todo: once batching is implmented, send a single response for all messages for msg in msgs: msg.ok() - del msgs + msgs = [] for i in range(6, 11): msg = queue.get(timeout=1) @@ -286,7 +286,7 @@ class MessageTests(TestBase): for msg in msgs: msg.ok() - del msgs + msgs = [] try: extra = queue.get(timeout=1) @@ -317,7 +317,6 @@ class MessageTests(TestBase): for i in range(1, 6): msg = queue.get(timeout=1) self.assertEqual("Message %d" % i, msg.body) - print "Got Message %d" % i msgs.append(msg) try: @@ -328,7 +327,7 @@ class MessageTests(TestBase): #ack messages and check that the next set arrive ok: for msg in msgs: msg.ok() - del msgs + msgs = [] for i in range(6, 11): msg = queue.get(timeout=1) @@ -337,7 +336,7 @@ class MessageTests(TestBase): for msg in msgs: msg.ok() - del msgs + msgs = [] try: extra = queue.get(timeout=1) |
