You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by as...@apache.org on 2019/08/30 22:17:22 UTC

[qpid-proton] branch master updated (2040a1c -> 07c25e0)

This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git.


    from 2040a1c  PROTON-2092: Make the changes work with C++ 03
     new 083c438  PROTON-2096: Adjust tox configuration to test recent versions of python3
     new 8f0f675  PROTON-2098: Correctly close connections from client end.
     new 07c25e0  PROTON-2099: [Python] Fix example test runner script

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 python/CMakeLists.txt            |   2 +-
 python/examples/test_examples.py | 178 ++++++++++++++++++++-------------------
 python/proton/_reactor.py        |   4 +-
 3 files changed, 92 insertions(+), 92 deletions(-)


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


[qpid-proton] 03/03: PROTON-2099: [Python] Fix example test runner script

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 07c25e0d917681fee6dae0ff3c713fc3d9f35158
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Aug 30 17:55:57 2019 -0400

    PROTON-2099: [Python] Fix example test runner script
---
 python/examples/test_examples.py | 178 ++++++++++++++++++++-------------------
 1 file changed, 90 insertions(+), 88 deletions(-)

diff --git a/python/examples/test_examples.py b/python/examples/test_examples.py
index 048f839..c33156d 100644
--- a/python/examples/test_examples.py
+++ b/python/examples/test_examples.py
@@ -18,21 +18,22 @@
 #
 
 import re
-import sys
 import subprocess
 import time
 import unittest
 
+
 def remove_unicode_prefix(line):
     return re.sub(r"u(['\"])", r"\1", line)
 
+
 class ExamplesTest(unittest.TestCase):
     def test_helloworld(self, example="helloworld.py"):
-        p = subprocess.Popen([example], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        p.wait()
-        output = [l.strip() for l in p.stdout]
-        self.assertEqual(output, ['Hello World!'])
+        with subprocess.Popen([example], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                             universal_newlines=True) as p:
+            p.wait()
+            output = [l.strip() for l in p.stdout]
+            self.assertEqual(output, ['Hello World!'])
 
     def test_helloworld_direct(self):
         self.test_helloworld('helloworld_direct.py')
@@ -47,32 +48,31 @@ class ExamplesTest(unittest.TestCase):
         self.test_helloworld('helloworld_direct_tornado.py')
 
     def test_simple_send_recv(self, recv='simple_recv.py', send='simple_send.py'):
-        r = subprocess.Popen([recv], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        s = subprocess.Popen([send], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        s.wait()
-        r.wait()
-        actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
-        expected = ["{'sequence': int32(%i)}" % (i+1,) for i in range(100)]
-        self.assertEqual(actual, expected)
+        with subprocess.Popen([recv], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as r:
+            with subprocess.Popen([send], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                                  universal_newlines=True):
+                pass
+            actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
+            expected = ["{'sequence': %i}" % (i+1,) for i in range(100)]
+            self.assertEqual(actual, expected)
 
     def test_client_server(self, client=['client.py'], server=['server.py'], sleep=0):
-        s = subprocess.Popen(server, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        if sleep:
-            time.sleep(sleep)
-        c = subprocess.Popen(client, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        c.wait()
-        s.terminate()
-        actual = [l.strip() for l in c.stdout]
-        inputs = ["Twas brillig, and the slithy toves",
-                    "Did gire and gymble in the wabe.",
-                    "All mimsy were the borogroves,",
-                    "And the mome raths outgrabe."]
-        expected = ["%s => %s" % (l, l.upper()) for l in inputs]
-        self.assertEqual(actual, expected)
+        with subprocess.Popen(server, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as s:
+            if sleep:
+                time.sleep(sleep)
+            with subprocess.Popen(client, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                                  universal_newlines=True) as c:
+                c.wait()
+                actual = [l.strip() for l in c.stdout]
+                inputs = ["Twas brillig, and the slithy toves",
+                          "Did gire and gymble in the wabe.",
+                          "All mimsy were the borogroves,",
+                          "And the mome raths outgrabe."]
+                expected = ["%s => %s" % (l, l.upper()) for l in inputs]
+                self.assertEqual(actual, expected)
+            s.terminate()
 
     def test_sync_client_server(self):
         self.test_client_server(client=['sync_client.py'])
@@ -94,73 +94,75 @@ class ExamplesTest(unittest.TestCase):
         # setup databases
         subprocess.check_call(['db_ctrl.py', 'init', './src_db'])
         subprocess.check_call(['db_ctrl.py', 'init', './dst_db'])
-        fill = subprocess.Popen(['db_ctrl.py', 'insert', './src_db'],
-                                stdin=subprocess.PIPE, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                                universal_newlines=True)
-        for i in range(100):
-            fill.stdin.write("Message-%i\n" % (i+1))
-        fill.stdin.close()
-        fill.wait()
+        with subprocess.Popen(['db_ctrl.py', 'insert', './src_db'],
+                              stdin=subprocess.PIPE, stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as fill:
+            for i in range(100):
+                fill.stdin.write("Message-%i\n" % (i+1))
+            fill.stdin.close()
+
         # run send and recv
-        r = subprocess.Popen(['db_recv.py', '-m', '100'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        s = subprocess.Popen(['db_send.py', '-m', '100'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        s.wait()
-        r.wait()
-        # verify output of receive
-        actual = [l.strip() for l in r.stdout]
-        expected = ["inserted message %i" % (i+1) for i in range(100)]
-        self.assertEqual(actual, expected)
+        with subprocess.Popen(['db_recv.py', '-m', '100'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as r:
+            with subprocess.Popen(['db_send.py', '-m', '100'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                                  universal_newlines=True):
+                pass
+            r.wait()
+            # verify output of receive
+            actual = [l.strip() for l in r.stdout]
+            expected = ["inserted message %i" % (i+1) for i in range(100)]
+            self.assertEqual(actual, expected)
+
         # verify state of databases
-        v = subprocess.Popen(['db_ctrl.py', 'list', './dst_db'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        v.wait()
-        expected = ["(%i, 'Message-%i')" % (i+1, i+1) for i in range(100)]
-        actual = [remove_unicode_prefix(l.strip()) for l in v.stdout]
-        self.assertEqual(actual, expected)
+        with subprocess.Popen(['db_ctrl.py', 'list', './dst_db'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as v:
+            v.wait()
+            expected = ["(%i, 'Message-%i')" % (i+1, i+1) for i in range(100)]
+            actual = [remove_unicode_prefix(l.strip()) for l in v.stdout]
+            self.assertEqual(actual, expected)
 
     def test_tx_send_tx_recv(self):
         self.test_simple_send_recv(recv='tx_recv.py', send='tx_send.py')
 
     def test_simple_send_direct_recv(self):
         self.maxDiff = None
-        r = subprocess.Popen(['direct_recv.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        time.sleep(0.5)
-        s = subprocess.Popen(['simple_send.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        s.wait()
-        r.wait()
-        actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
-        expected = ["{'sequence': int32(%i)}" % (i+1,) for i in range(100)]
-        self.assertEqual(actual, expected)
+        with subprocess.Popen(['direct_recv.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as r:
+            time.sleep(0.5)
+            with subprocess.Popen(['simple_send.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                             universal_newlines=True):
+                pass
+            r.wait()
+            actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
+            expected = ["{'sequence': %i}" % (i+1,) for i in range(100)]
+            self.assertEqual(actual, expected)
 
     def test_direct_send_simple_recv(self):
-        s = subprocess.Popen(['direct_send.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        time.sleep(0.5)
-        r = subprocess.Popen(['simple_recv.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        r.wait()
-        s.wait()
-        actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
-        expected = ["{'sequence': int32(%i)}" % (i+1,) for i in range(100)]
-        self.assertEqual(actual, expected)
+        with subprocess.Popen(['direct_send.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True):
+            time.sleep(0.5)
+            with subprocess.Popen(['simple_recv.py', '-a', 'localhost:8888'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                                  universal_newlines=True) as r:
+                r.wait()
+                actual = [remove_unicode_prefix(l.strip()) for l in r.stdout]
+                expected = ["{'sequence': %i}" % (i+1,) for i in range(100)]
+                self.assertEqual(actual, expected)
 
     def test_selected_recv(self):
-        s = subprocess.Popen(['colour_send.py'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        s.wait()
-        r = subprocess.Popen(['selected_recv.py', '-m', '50'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        r.wait()
-        actual = [l.strip() for l in r.stdout]
-        expected = ["green %i" % (i+1) for i in range(100) if i % 2 == 0]
-        self.assertEqual(actual, expected)
-        r2 = subprocess.Popen(['simple_recv.py', '-m', '50'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
-                             universal_newlines=True)
-        r2.wait()
-        actual = [l.strip() for l in r2.stdout]
-        expected = ["red %i" % (i+1) for i in range(100) if i % 2 == 1]
-        self.assertEqual(actual, expected)
+        with subprocess.Popen(['colour_send.py'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True):
+            pass
+
+        with subprocess.Popen(['selected_recv.py', '-m', '50'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as r:
+            r.wait()
+            actual = [l.strip() for l in r.stdout]
+            expected = ["green %i" % (i+1) for i in range(100) if i % 2 == 0]
+            self.assertEqual(actual, expected)
+
+        with subprocess.Popen(['simple_recv.py', '-m', '50'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE,
+                              universal_newlines=True) as r:
+            r.wait()
+            actual = [l.strip() for l in r.stdout]
+            expected = ["red %i" % (i+1) for i in range(100) if i % 2 == 1]
+            self.assertEqual(actual, expected)


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


[qpid-proton] 02/03: PROTON-2098: Correctly close connections from client end.

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 8f0f675d1e08340332200f869cf9bffda76c2aa0
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Aug 30 10:59:31 2019 -0400

    PROTON-2098: Correctly close connections from client end.
---
 python/proton/_reactor.py | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/python/proton/_reactor.py b/python/proton/_reactor.py
index 6f44841..e87774a 100644
--- a/python/proton/_reactor.py
+++ b/python/proton/_reactor.py
@@ -961,12 +961,10 @@ class Connector(Handler):
         if self.reconnect:
             self.reconnect.reset()
 
-    def on_transport_tail_closed(self, event):
-        event.transport.close_head()
-
     def on_transport_closed(self, event):
         if self.connection is None: return
         if self.connection.state & Endpoint.LOCAL_ACTIVE:
+
             if self.reconnect:
                 event.transport.unbind()
                 delay = self.reconnect.next()


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


[qpid-proton] 01/03: PROTON-2096: Adjust tox configuration to test recent versions of python3

Posted by as...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

astitcher pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/qpid-proton.git

commit 083c4384a8e94a04a3f96bf36da4e411a7bdd1c4
Author: Andrew Stitcher <as...@apache.org>
AuthorDate: Fri Aug 30 11:17:36 2019 -0400

    PROTON-2096: Adjust tox configuration to test recent versions of python3
---
 python/CMakeLists.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt
index b5c1f3b..aacb665 100644
--- a/python/CMakeLists.txt
+++ b/python/CMakeLists.txt
@@ -217,7 +217,7 @@ if (NOT TOX_MODULE_FOUND)
 else ()
   option(ENABLE_TOX_TEST "Enable multi-version python testing with TOX" ON)
 
-  set(tox_default "py26,py27,py34,py35,py36")
+  set(tox_default "py26,py27,py35,py36,py37,py38")
   set(TOX_ENVLIST "" CACHE STRING "List of python environments for TOX tests" )
   mark_as_advanced(TOX_ENVLIST)
 


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