qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1487578 - in /qpid/trunk/qpid: cpp/src/tests/brokertest.py python/qpid/messaging/endpoints.py
Date Wed, 29 May 2013 18:03:50 GMT
Author: aconway
Date: Wed May 29 18:03:50 2013
New Revision: 1487578

URL: http://svn.apache.org/r1487578
Log:
NO-JIRA: Added connection timeout to python client, used in brokertests.

Added an optional timeout parameter to Connection.establish.
Set a timeout of 5 seconds in brokertest.py to prevent hanging tests.

Modified:
    qpid/trunk/qpid/cpp/src/tests/brokertest.py
    qpid/trunk/qpid/python/qpid/messaging/endpoints.py

Modified: qpid/trunk/qpid/cpp/src/tests/brokertest.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/cpp/src/tests/brokertest.py?rev=1487578&r1=1487577&r2=1487578&view=diff
==============================================================================
--- qpid/trunk/qpid/cpp/src/tests/brokertest.py (original)
+++ qpid/trunk/qpid/cpp/src/tests/brokertest.py Wed May 29 18:03:50 2013
@@ -305,9 +305,9 @@ class Broker(Popen):
     def unexpected(self,msg):
         raise BadProcessStatus("%s: %s (%s)" % (msg, self.name, self.pname))
 
-    def connect(self, **kwargs):
+    def connect(self, timeout=5, **kwargs):
         """New API connection to the broker."""
-        return messaging.Connection.establish(self.host_port(), **kwargs)
+        return messaging.Connection.establish(self.host_port(), timeout=timeout, **kwargs)
 
     def connect_old(self):
         """Old API connection to the broker."""

Modified: qpid/trunk/qpid/python/qpid/messaging/endpoints.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/endpoints.py?rev=1487578&r1=1487577&r2=1487578&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/messaging/endpoints.py (original)
+++ qpid/trunk/qpid/python/qpid/messaging/endpoints.py Wed May 29 18:03:50 2013
@@ -59,13 +59,13 @@ class Connection(Endpoint):
   """
 
   @static
-  def establish(url=None, **options):
+  def establish(url=None, timeout=None, **options):
     """
     Constructs a L{Connection} with the supplied parameters and opens
     it.
     """
     conn = Connection(url, **options)
-    conn.open()
+    conn.open(timeout=timeout)
     return conn
 
   def __init__(self, url=None, **options):
@@ -257,14 +257,13 @@ class Connection(Endpoint):
     self.sessions.pop(ssn.name, 0)
 
   @synchronized
-  def open(self):
+  def open(self, timeout=None):
     """
     Opens a connection.
     """
     if self._open:
       raise ConnectionError("already open")
     self._open = True
-    timeout = None
     if self.reconnect and self.reconnect_timeout > 0:
         timeout = self.reconnect_timeout
     self.attach(timeout=timeout)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message