qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject qpid-proton git commit: NO-JIRA: Get utils.py test_request_response working on jython.
Date Tue, 27 Jan 2015 18:29:34 GMT
Repository: qpid-proton
Updated Branches:
  refs/heads/master c098bf0dd -> b4d0135c0


NO-JIRA: Get utils.py test_request_response working on jython.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/b4d0135c
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/b4d0135c
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/b4d0135c

Branch: refs/heads/master
Commit: b4d0135c08cbdc3343ec5e9144a331447c35f392
Parents: c098bf0
Author: Alan Conway <aconway@redhat.com>
Authored: Tue Jan 27 12:25:39 2015 -0500
Committer: Alan Conway <aconway@redhat.com>
Committed: Tue Jan 27 12:25:39 2015 -0500

----------------------------------------------------------------------
 tests/python/proton_tests/utils.py | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/b4d0135c/tests/python/proton_tests/utils.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/utils.py b/tests/python/proton_tests/utils.py
index 11f9cc1..9973dd4 100644
--- a/tests/python/proton_tests/utils.py
+++ b/tests/python/proton_tests/utils.py
@@ -17,8 +17,8 @@
 # under the License.
 #
 
-import os
-from threading import Thread
+import os, time
+from threading import Thread, Event
 from unittest import TestCase
 from proton_tests.common import Test, free_tcp_port
 from copy import copy
@@ -40,10 +40,12 @@ class EchoServer(MessagingHandler, Thread):
         self.url = url
         self.senders = {}
         self.container = None
+        self.event = Event()
 
     def on_start(self, event):
         self.acceptor = event.container.listen(self.url)
         self.container = event.container
+        self.event.set()
 
     def on_link_opening(self, event):
         if event.link.is_sender:
@@ -65,6 +67,9 @@ class EchoServer(MessagingHandler, Thread):
     def run(self):
         Container(self).run()
 
+    def wait(self, timeout):
+        self.event.wait(timeout)
+
 
 class SyncRequestResponseTest(Test):
     """Test SyncRequestResponse"""
@@ -77,9 +82,11 @@ class SyncRequestResponseTest(Test):
                 self.assertEquals(response.address, client.reply_to)
                 self.assertEquals(response.body, body)
 
-        server = EchoServer(Url(port=free_tcp_port()))
+        server = EchoServer(Url(host='127.0.0.1', port=free_tcp_port()))
         server.start()
-        client = SyncRequestResponse(BlockingConnection(server.url, timeout=self.timeout))
+        server.wait(self.timeout)
+        connection = BlockingConnection(server.url, timeout=self.timeout)
+        client = SyncRequestResponse(connection)
         try:
             test("foo")         # Simple request/resposne
         finally:


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


Mime
View raw message