[ARVADOS] updated: 86680eab88b02d7f8bfe2f76308668957c825c36

git at public.curoverse.com git at public.curoverse.com
Tue May 27 10:36:59 EDT 2014


Summary of changes:
 sdk/python/arvados/keep.py     |  2 +-
 sdk/python/test_keep_client.py | 19 ++++++++++++++++---
 2 files changed, 17 insertions(+), 4 deletions(-)

       via  86680eab88b02d7f8bfe2f76308668957c825c36 (commit)
      from  c0c0d769cd812e87efa392649380dc5ba8a25cd4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit 86680eab88b02d7f8bfe2f76308668957c825c36
Author: Peter Amstutz <peter.amstutz at curoverse.com>
Date:   Tue May 27 10:36:56 2014 -0400

    2751: Changed to "except:" to "except Exception:".  Refactored environment setup in keep_client_Test to be a bit more robust.

diff --git a/sdk/python/arvados/keep.py b/sdk/python/arvados/keep.py
index 6561c70..f5014a4 100644
--- a/sdk/python/arvados/keep.py
+++ b/sdk/python/arvados/keep.py
@@ -180,7 +180,7 @@ class KeepClient(object):
                 try:
                     try:
                         keep_services = arvados.api().keep_services().accessible().execute()['items']
-                    except:
+                    except Exception:
                         keep_services = arvados.api().keep_disks().list().execute()['items']
 
                     if len(keep_services) == 0:
diff --git a/sdk/python/test_keep_client.py b/sdk/python/test_keep_client.py
index c1afa7a..fad7872 100644
--- a/sdk/python/test_keep_client.py
+++ b/sdk/python/test_keep_client.py
@@ -16,6 +16,11 @@ class KeepTestCase(unittest.TestCase):
         except KeyError:
             pass
 
+        # Make sure these are clear, we want to talk to the Keep servers
+        # directly.
+        os.environ["ARVADOS_KEEP_PROXY"] = ""
+        os.environ["ARVADOS_EXTERNAL_CLIENT"] = ""
+
         run_test_server.run()
         run_test_server.run_keep()
         arvados.keep.global_client_object = None
@@ -81,11 +86,16 @@ class KeepProxyTestCase(unittest.TestCase):
             del os.environ['KEEP_LOCAL_STORE']
         except KeyError:
             pass
+
+        os.environ["ARVADOS_KEEP_PROXY"] = ""
+        os.environ["ARVADOS_EXTERNAL_CLIENT"] = ""
+
         run_test_server.run()
         run_test_server.run_keep()
         arvados.keep.global_client_object = None
         arvados.config._settings = None
         run_test_server.run_keep_proxy("admin")
+        cls.arvados_keep_proxy = os.environ["ARVADOS_KEEP_PROXY"]
 
     @classmethod
     def tearDownClass(cls):
@@ -93,12 +103,12 @@ class KeepProxyTestCase(unittest.TestCase):
         run_test_server.stop()
         run_test_server.stop_keep()
         run_test_server.stop_keep_proxy()
-        os.environ["ARVADOS_KEEP_PROXY"] = ""
-        os.environ["ARVADOS_EXTERNAL_CLIENT"] = ""
 
     def test_KeepProxyTest1(self):
         # Will use ARVADOS_KEEP_PROXY environment variable that is set by
-        # run_keep_proxy()
+        # run_keep_proxy() in setUpClass()
+        os.environ["ARVADOS_KEEP_PROXY"] = KeepProxyTestCase.arvados_keep_proxy
+        os.environ["ARVADOS_EXTERNAL_CLIENT"] = ""
 
         baz_locator = arvados.Keep.put('baz')
         self.assertEqual(baz_locator,
@@ -111,6 +121,9 @@ class KeepProxyTestCase(unittest.TestCase):
         self.assertEqual(True, arvados.Keep.global_client_object().using_proxy)
 
     def test_KeepProxyTest2(self):
+        # We don't want to use ARVADOS_KEEP_PROXY from run_keep_proxy() in
+        # setUpClass(), so clear it and set ARVADOS_EXTERNAL_CLIENT which will
+        # contact the API server.
         os.environ["ARVADOS_KEEP_PROXY"] = ""
         os.environ["ARVADOS_EXTERNAL_CLIENT"] = "true"
         arvados.config._settings = None

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list