diff options
| author | Gordon Sim <gsim@apache.org> | 2013-07-16 10:50:43 +0000 |
|---|---|---|
| committer | Gordon Sim <gsim@apache.org> | 2013-07-16 10:50:43 +0000 |
| commit | 156e666579700160b56331c89c8216e278fed90f (patch) | |
| tree | 5fd77e11c9165f2c619501d5274ec2b379f106b8 /qpid/python | |
| parent | 42b37635a7b0252c7cdaae11b431d8d3c67cbae9 (diff) | |
| download | qpid-python-156e666579700160b56331c89c8216e278fed90f.tar.gz | |
QPID-4988: Add test runs using swigged python client
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1503652 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/qpid/tests/messaging/__init__.py | 14 | ||||
| -rw-r--r-- | qpid/python/qpid/tests/messaging/implementation.py | 24 | ||||
| -rw-r--r-- | qpid/python/qpid/tests/messaging/message.py | 12 |
3 files changed, 44 insertions, 6 deletions
diff --git a/qpid/python/qpid/tests/messaging/__init__.py b/qpid/python/qpid/tests/messaging/__init__.py index 8f6680d5e3..5c9cdf2f27 100644 --- a/qpid/python/qpid/tests/messaging/__init__.py +++ b/qpid/python/qpid/tests/messaging/__init__.py @@ -20,7 +20,7 @@ import time from math import ceil from qpid.harness import Skipped -from qpid.messaging import * +from qpid.tests.messaging.implementation import * from qpid.tests import Test class Base(Test): @@ -115,7 +115,7 @@ class Base(Test): echo = echo.content assert msg == echo, "expected %s, got %s" % (msg, echo) else: - delta = self.diff(msg, echo, ("x-amqp-0-10.routing-key",)) + delta = self.diff(msg, echo, ("x-amqp-0-10.routing-key","qpid.subject")) mttl, ettl = delta.pop("ttl", (0, 0)) if redelivered: assert echo.redelivered, \ @@ -179,7 +179,13 @@ class Base(Test): return "tcp" def connection_options(self): - return {"reconnect": self.reconnect(), - "transport": self.transport()} + protocol_version = self.config.defines.get("protocol_version") + if protocol_version: + return {"reconnect": self.reconnect(), + "transport": self.transport(), + "protocol":protocol_version} + else: + return {"reconnect": self.reconnect(), + "transport": self.transport()} import address, endpoints, message diff --git a/qpid/python/qpid/tests/messaging/implementation.py b/qpid/python/qpid/tests/messaging/implementation.py new file mode 100644 index 0000000000..ac0e02dba7 --- /dev/null +++ b/qpid/python/qpid/tests/messaging/implementation.py @@ -0,0 +1,24 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +# +try: + from cqpid import * + from qpid.datatypes import uuid4 +except ImportError, e: + print "Falling back to pure bindings, %s" % e + from qpid.messaging import * diff --git a/qpid/python/qpid/tests/messaging/message.py b/qpid/python/qpid/tests/messaging/message.py index 7328165db7..b59dc53084 100644 --- a/qpid/python/qpid/tests/messaging/message.py +++ b/qpid/python/qpid/tests/messaging/message.py @@ -17,7 +17,8 @@ # under the License. # -from qpid.messaging import * +from qpid.tests.messaging.implementation import * +from qpid.messaging.address import parse from qpid.tests.messaging import Base class MessageTests(Base): @@ -126,7 +127,14 @@ class MessageEchoTests(Base): msg = Message(reply_to=addr) self.snd.send(msg) echo = self.rcv.fetch(0) - assert echo.reply_to == expected, echo.reply_to + #reparse addresses and check individual parts as this avoids + #failing due to differenecs in whitespace when running over + #swigged client: + (actual_name, actual_subject, actual_options) = parse(echo.reply_to) + (expected_name, expected_subject, expected_options) = parse(expected) + assert actual_name == expected_name, (actual_name, expected_name) + assert actual_subject == expected_subject, (actual_subject, expected_subject) + assert actual_options == expected_options, (actual_options, expected_options) self.ssn.acknowledge(echo) def testReplyTo(self): |
