Author: gsim
Date: Fri Feb  9 05:44:08 2007
New Revision: 505287

URL: http://svn.apache.org/viewvc?view=rev&rev=505287
Log:
* 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


Modified:
    incubator/qpid/branches/qpid.0-9/python/qpid/peer.py
    incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py
    incubator/qpid/branches/qpid.0-9/python/tests/basic.py
    incubator/qpid/branches/qpid.0-9/python/tests/message.py

Modified: incubator/qpid/branches/qpid.0-9/python/qpid/peer.py
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/peer.py?view=diff&rev=505287&r1=505286&r2=505287
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/peer.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/peer.py Fri Feb  9 05:44:08 
2007
@@ -89,7 +89,7 @@
         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 @@
           content = None
 
         self.delegate(channel, Message(channel, frame, content))
+    except QueueClosed, e:
+      self.close(e)
     except:
       self.fatal()
 

Modified: incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py?view=diff&rev=505287&r1=505286&r2=505287
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/qpid/testlib.py Fri Feb  9 05:44:08 
2007
@@ -171,6 +171,10 @@
         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)

Modified: incubator/qpid/branches/qpid.0-9/python/tests/basic.py
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/tests/basic.py?view=diff&rev=505287&r1=505286&r2=505287
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/tests/basic.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/tests/basic.py Fri Feb  9 05:44:08 
2007
@@ -147,7 +147,7 @@
         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)

Modified: incubator/qpid/branches/qpid.0-9/python/tests/message.py
URL: 
http://svn.apache.org/viewvc/incubator/qpid/branches/qpid.0-9/python/tests/message.py?view=diff&rev=505287&r1=505286&r2=505287
==============================================================================
--- incubator/qpid/branches/qpid.0-9/python/tests/message.py (original)
+++ incubator/qpid/branches/qpid.0-9/python/tests/message.py Fri Feb  9 
05:44:08 2007
@@ -277,7 +277,7 @@
         #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 @@
 
         for msg in msgs:
             msg.ok()
-        del msgs    
+        msgs = []    
 
         try:
             extra = queue.get(timeout=1)
@@ -317,7 +317,6 @@
         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 @@
         #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 @@
 
         for msg in msgs:
             msg.ok()
-        del msgs    
+        msgs = []    
 
         try:
             extra = queue.get(timeout=1)


Reply via email to