You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@qpid.apache.org by ac...@apache.org on 2014/09/25 21:40:23 UTC

svn commit: r1627621 - in /qpid/proton/trunk: proton-c/bindings/python/proton.py tests/python/proton_tests/url.py

Author: aconway
Date: Thu Sep 25 19:40:22 2014
New Revision: 1627621

URL: http://svn.apache.org/r1627621
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/trunk/proton-c/bindings/python/proton.py
    qpid/proton/trunk/tests/python/proton_tests/url.py

Modified: qpid/proton/trunk/proton-c/bindings/python/proton.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/proton-c/bindings/python/proton.py?rev=1627621&r1=1627620&r2=1627621&view=diff
==============================================================================
--- qpid/proton/trunk/proton-c/bindings/python/proton.py (original)
+++ qpid/proton/trunk/proton-c/bindings/python/proton.py Thu Sep 25 19:40:22 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/trunk/tests/python/proton_tests/url.py
URL: http://svn.apache.org/viewvc/qpid/proton/trunk/tests/python/proton_tests/url.py?rev=1627621&r1=1627620&r2=1627621&view=diff
==============================================================================
--- qpid/proton/trunk/tests/python/proton_tests/url.py (original)
+++ qpid/proton/trunk/tests/python/proton_tests/url.py Thu Sep 25 19:40:22 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-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org