Author: gsim Date: Fri Oct 10 12:57:33 2014 New Revision: 1630858 URL: http://svn.apache.org/r1630858 Log: NO-JIRA: Fix URL test to not explode under jython.
Turns out the proton test harness blows up when run under jython if you "import socket" in a test module. Works fine under real python. Go figure. Modified: qpid/proton/branches/examples/proton-c/bindings/python/proton.py qpid/proton/branches/examples/tests/python/proton_tests/url.py Modified: qpid/proton/branches/examples/proton-c/bindings/python/proton.py URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/proton-c/bindings/python/proton.py?rev=1630858&r1=1630857&r2=1630858&view=diff ============================================================================== --- qpid/proton/branches/examples/proton-c/bindings/python/proton.py (original) +++ qpid/proton/branches/examples/proton-c/bindings/python/proton.py Fri Oct 10 12:57:33 2014 @@ -3694,7 +3694,8 @@ class Url(object): """An integer port number that can be constructed from a service name string""" def __new__(cls, value): - port = super(Url.Port, cls).__new__(cls, cls.port_int(value)) + """@param value: integer port number or string service name.""" + port = super(Url.Port, cls).__new__(cls, cls._port_int(value)) setattr(port, 'name', str(value)) return port @@ -3703,7 +3704,7 @@ class Url(object): def __str__(self): return str(self.name) @staticmethod - def port_int(value): + def _port_int(value): """Convert service, an integer or a service name, into an integer port number.""" try: return int(value) Modified: qpid/proton/branches/examples/tests/python/proton_tests/url.py URL: http://svn.apache.org/viewvc/qpid/proton/branches/examples/tests/python/proton_tests/url.py?rev=1630858&r1=1630857&r2=1630858&view=diff ============================================================================== --- qpid/proton/branches/examples/tests/python/proton_tests/url.py (original) +++ qpid/proton/branches/examples/tests/python/proton_tests/url.py Fri Oct 10 12:57:33 2014 @@ -18,7 +18,7 @@ # -import common, socket +import common from proton import Url class UrlTest(common.Test): @@ -108,8 +108,9 @@ class UrlTest(common.Test): def testAmqps(self): """Some old platforms don't recognize the amqps service name, this test is a no-op if that is the case otherwise verify we treat amqps correctly.""" - try: socket.getservbyname('amqps') - except: + try: + Url.Port('amqps') + except ValueError: print "skipping: service 'amqps' not recognized on this platform" return # Scheme defaults --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org For additional commands, e-mail: commits-h...@qpid.apache.org