From commits-return-47824-apmail-qpid-commits-archive=qpid.apache.org@qpid.apache.org Thu Feb 21 16:00:49 2019 Return-Path: X-Original-To: apmail-qpid-commits-archive@www.apache.org Delivered-To: apmail-qpid-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 32DD818309 for ; Thu, 21 Feb 2019 16:00:49 +0000 (UTC) Received: (qmail 61194 invoked by uid 500); 21 Feb 2019 16:00:49 -0000 Delivered-To: apmail-qpid-commits-archive@qpid.apache.org Received: (qmail 61139 invoked by uid 500); 21 Feb 2019 16:00:48 -0000 Mailing-List: contact commits-help@qpid.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@qpid.apache.org Delivered-To: mailing list commits@qpid.apache.org Received: (qmail 61127 invoked by uid 99); 21 Feb 2019 16:00:48 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 21 Feb 2019 16:00:48 +0000 Received: by gitbox.apache.org (ASF Mail Server at gitbox.apache.org, from userid 33) id E11A5851A8; Thu, 21 Feb 2019 16:00:47 +0000 (UTC) Date: Thu, 21 Feb 2019 16:00:47 +0000 To: "commits@qpid.apache.org" Subject: [qpid-proton] branch master updated: PROTON-2007: Correct example tests for the case where the system python differs from the harness python MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Message-ID: <155076484785.28761.16103733756628296957@gitbox.apache.org> From: jross@apache.org X-Git-Host: gitbox.apache.org X-Git-Repo: qpid-proton X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 178eead5a95efd2eb4c985b81f8bd8d3de382397 X-Git-Newrev: 25617ea41fffe6d31ae120979a7c1d482cd4f88f X-Git-Rev: 25617ea41fffe6d31ae120979a7c1d482cd4f88f X-Git-NotificationType: ref_changed_plus_diff X-Git-Multimail-Version: 1.5.dev Auto-Submitted: auto-generated This is an automated email from the ASF dual-hosted git repository. jross pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/qpid-proton.git The following commit(s) were added to refs/heads/master by this push: new 25617ea PROTON-2007: Correct example tests for the case where the system python differs from the harness python 25617ea is described below commit 25617ea41fffe6d31ae120979a7c1d482cd4f88f Author: Justin Ross AuthorDate: Thu Feb 21 05:22:48 2019 -0800 PROTON-2007: Correct example tests for the case where the system python differs from the harness python --- python/examples/test_examples.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/python/examples/test_examples.py b/python/examples/test_examples.py index aa6e2a5..048f839 100644 --- a/python/examples/test_examples.py +++ b/python/examples/test_examples.py @@ -17,16 +17,14 @@ # under the License. # +import re import sys import subprocess import time import unittest -if sys.version_info[0] == 2: - _unicode_prefix = 'u' -else: - _unicode_prefix = '' - +def remove_unicode_prefix(line): + return re.sub(r"u(['\"])", r"\1", line) class ExamplesTest(unittest.TestCase): def test_helloworld(self, example="helloworld.py"): @@ -55,8 +53,8 @@ class ExamplesTest(unittest.TestCase): universal_newlines=True) s.wait() r.wait() - actual = [l.strip() for l in r.stdout] - expected = ["{%s'sequence': int32(%i)}" % (_unicode_prefix, (i+1)) for i in range(100)] + 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) def test_client_server(self, client=['client.py'], server=['server.py'], sleep=0): @@ -118,8 +116,8 @@ class ExamplesTest(unittest.TestCase): v = subprocess.Popen(['db_ctrl.py', 'list', './dst_db'], stderr=subprocess.STDOUT, stdout=subprocess.PIPE, universal_newlines=True) v.wait() - expected = ["(%i, %s'Message-%i')" % ((i+1), _unicode_prefix, (i+1)) for i in range(100)] - actual = [l.strip() for l in v.stdout] + 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): @@ -134,8 +132,8 @@ class ExamplesTest(unittest.TestCase): universal_newlines=True) s.wait() r.wait() - actual = [l.strip() for l in r.stdout] - expected = ["{%s'sequence': int32(%i)}" % (_unicode_prefix, (i+1)) for i in range(100)] + 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) def test_direct_send_simple_recv(self): @@ -146,8 +144,8 @@ class ExamplesTest(unittest.TestCase): universal_newlines=True) r.wait() s.wait() - actual = [l.strip() for l in r.stdout] - expected = ["{%s'sequence': int32(%i)}" % (_unicode_prefix, (i+1)) for i in range(100)] + 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) def test_selected_recv(self): --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org For additional commands, e-mail: commits-help@qpid.apache.org