Repository: qpid-proton
Updated Branches:
  refs/heads/master d24bd64b9 -> 2cc425522


PROTON-1268: Test fixes, that allow direct tox testing to work better.


Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo
Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/2cc42552
Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/2cc42552
Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/2cc42552

Branch: refs/heads/master
Commit: 2cc425522084933a84658a5fb8cc4780e8fe0f52
Parents: d24bd64
Author: Andrew Stitcher <[email protected]>
Authored: Fri Jul 22 18:41:38 2016 -0400
Committer: Andrew Stitcher <[email protected]>
Committed: Fri Jul 22 18:41:38 2016 -0400

----------------------------------------------------------------------
 tests/python/proton_tests/common.py  | 27 ++++++++++++++-------------
 tests/python/proton_tests/reactor.py |  3 +++
 tests/python/proton_tests/utils.py   |  4 +++-
 3 files changed, 20 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2cc42552/tests/python/proton_tests/common.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/common.py 
b/tests/python/proton_tests/common.py
index 9cc0ba2..aaefccd 100644
--- a/tests/python/proton_tests/common.py
+++ b/tests/python/proton_tests/common.py
@@ -114,6 +114,16 @@ def pump(transport1, transport2, buffer_size=1024):
          pump_uni(transport2, transport1, buffer_size)):
     pass
 
+def findfileinpath(filename, searchpath):
+    """Find filename in the searchpath
+        return absolute path to the file or None
+    """
+    paths = searchpath.split(os.pathsep)
+    for path in paths:
+        if os.path.exists(os.path.join(path, filename)):
+            return os.path.abspath(os.path.join(path, filename))
+    return None
+
 def isSSLPresent():
     return SSL.present()
 
@@ -125,6 +135,8 @@ def _cyrusSetup(conf_dir):
   saslpasswd = ""
   if 'SASLPASSWD' in os.environ:
     saslpasswd = os.environ['SASLPASSWD']
+  else:
+    saslpasswd = findfileinpath('saslpasswd2', os.getenv('PATH')) or ""
   if os.path.exists(saslpasswd):
     t = Template("""sasldb_path: ${db}
 mech_list: EXTERNAL DIGEST-MD5 SCRAM-SHA-1 CRAM-MD5 PLAIN ANONYMOUS
@@ -268,16 +280,6 @@ class MessengerApp(object):
         self.password = None
         self._output = None
 
-    def findfile(self, filename, searchpath):
-        """Find filename in the searchpath
-            return absolute path to the file or None
-        """
-        paths = searchpath.split(os.pathsep)
-        for path in paths:
-            if os.path.exists(os.path.join(path, filename)):
-                return os.path.abspath(os.path.join(path, filename))
-        return None
-
     def start(self, verbose=False):
         """ Begin executing the test """
         cmd = self.cmdline()
@@ -289,10 +291,9 @@ class MessengerApp(object):
             # Handle python launch by replacing script 'filename' with
             # 'python abspath-to-filename' in cmdline arg list.
             if cmd[0].endswith('.py'):
-                foundfile = self.findfile(cmd[0], os.environ['PATH'])
+                foundfile = findfileinpath(cmd[0], os.getenv('PATH'))
                 if foundfile is None:
-                    foundfile = self.findfile(cmd[0], os.environ['PYTHONPATH'])
-                    msg = "Unable to locate file '%s' in PATH or PYTHONPATH" % 
cmd[0]
+                    msg = "Unable to locate file '%s' in PATH" % cmd[0]
                     raise Skipped("Skipping test - %s" % msg)
 
                 del cmd[0:1]

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2cc42552/tests/python/proton_tests/reactor.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/reactor.py 
b/tests/python/proton_tests/reactor.py
index 1f04e5e..a25dc2f 100644
--- a/tests/python/proton_tests/reactor.py
+++ b/tests/python/proton_tests/reactor.py
@@ -571,6 +571,7 @@ class ContainerTest(Test):
             event.connection.close()
 
     def test_numeric_hostname(self):
+        ensureCanTestExtendedSASL()
         server_handler = ContainerTest._ServerHandler("127.0.0.1")
         client_handler = ContainerTest._ClientHandler()
         container = Container(server_handler)
@@ -584,6 +585,7 @@ class ContainerTest(Test):
         assert client_handler.server_addr.rsplit(':', 1)[1] == 
str(server_handler.port)
 
     def test_non_numeric_hostname(self):
+        ensureCanTestExtendedSASL()
         server_handler = ContainerTest._ServerHandler("localhost")
         client_handler = ContainerTest._ClientHandler()
         container = Container(server_handler)
@@ -597,6 +599,7 @@ class ContainerTest(Test):
         assert client_handler.server_addr.rsplit(':', 1)[1] == 
str(server_handler.port)
 
     def test_virtual_host(self):
+        ensureCanTestExtendedSASL()
         server_handler = ContainerTest._ServerHandler("localhost")
         container = Container(server_handler)
         conn = container.connect(url=Url(host="localhost",

http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/2cc42552/tests/python/proton_tests/utils.py
----------------------------------------------------------------------
diff --git a/tests/python/proton_tests/utils.py 
b/tests/python/proton_tests/utils.py
index ca11f21..c598251 100644
--- a/tests/python/proton_tests/utils.py
+++ b/tests/python/proton_tests/utils.py
@@ -26,7 +26,7 @@ from proton import Message, Url, generate_uuid, Array, 
UNDESCRIBED, Data, symbol
 from proton.handlers import MessagingHandler
 from proton.reactor import Container
 from proton.utils import SyncRequestResponse, BlockingConnection
-from .common import Skipped
+from .common import Skipped, ensureCanTestExtendedSASL
 CONNECTION_PROPERTIES={u'connection': u'properties'}
 OFFERED_CAPABILITIES = Array(UNDESCRIBED, Data.SYMBOL, symbol("O_one"), 
symbol("O_two"), symbol("O_three"))
 DESIRED_CAPABILITIES = Array(UNDESCRIBED, Data.SYMBOL, symbol("D_one"), 
symbol("D_two"), symbol("D_three"))
@@ -98,6 +98,7 @@ class SyncRequestResponseTest(Test):
     """Test SyncRequestResponse"""
 
     def test_request_response(self):
+        ensureCanTestExtendedSASL()
         def test(name, address="x"):
             for i in range(5):
                 body="%s%s" % (name, i)
@@ -118,6 +119,7 @@ class SyncRequestResponseTest(Test):
 
 
     def test_connection_properties(self):
+        ensureCanTestExtendedSASL()
         server = ConnPropertiesServer(Url(host="127.0.0.1", 
port=free_tcp_port()), timeout=self.timeout)
         server.start()
         server.wait()


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to