[ARVADOS] updated: 0db5d13dc2727545b5e6d09062dd4c432f2bdbe4

git at public.curoverse.com git at public.curoverse.com
Fri Nov 7 16:01:41 EST 2014


Summary of changes:
 sdk/python/arvados/collection.py     | 10 +++++-----
 sdk/python/tests/test_collections.py |  7 +++++++
 2 files changed, 12 insertions(+), 5 deletions(-)

       via  0db5d13dc2727545b5e6d09062dd4c432f2bdbe4 (commit)
      from  370df5a95b6b143885fa4d96be90c51f25f8ad14 (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 0db5d13dc2727545b5e6d09062dd4c432f2bdbe4
Author: Brett Smith <brett at curoverse.com>
Date:   Fri Nov 7 16:00:53 2014 -0500

    PySDK CollectionReader can get empty collection.
    
    Fixing a regression from refs #3706.

diff --git a/sdk/python/arvados/collection.py b/sdk/python/arvados/collection.py
index 3a90d6d..390ed3b 100644
--- a/sdk/python/arvados/collection.py
+++ b/sdk/python/arvados/collection.py
@@ -177,22 +177,22 @@ class CollectionReader(CollectionBase):
             return
         error_via_api = None
         error_via_keep = None
-        should_try_keep = (not self._manifest_text and
+        should_try_keep = ((self._manifest_text is None) and
                            util.keep_locator_pattern.match(
                 self._manifest_locator))
-        if (not self._manifest_text and
+        if ((self._manifest_text is None) and
             util.signed_locator_pattern.match(self._manifest_locator)):
             error_via_keep = self._populate_from_keep()
-        if not self._manifest_text:
+        if self._manifest_text is None:
             error_via_api = self._populate_from_api_server()
             if error_via_api is not None and not should_try_keep:
                 raise error_via_api
-        if (not self._manifest_text and
+        if ((self._manifest_text is None) and
             not error_via_keep and
             should_try_keep):
             # Looks like a keep locator, and we didn't already try keep above
             error_via_keep = self._populate_from_keep()
-        if not self._manifest_text:
+        if self._manifest_text is None:
             # Nothing worked!
             raise arvados.errors.NotFoundError(
                 ("Failed to retrieve collection '{}' " +
diff --git a/sdk/python/tests/test_collections.py b/sdk/python/tests/test_collections.py
index c4c7ca2..e275f38 100644
--- a/sdk/python/tests/test_collections.py
+++ b/sdk/python/tests/test_collections.py
@@ -801,6 +801,13 @@ class CollectionReaderTestCase(unittest.TestCase, CollectionTestMixin):
             [[f.size(), f.stream_name(), f.name()]
              for f in reader.all_streams()[0].all_files()])
 
+    def test_read_empty_collection(self):
+        client = self.api_client_mock(200)
+        self.mock_get_collection(client, 200, 'empty')
+        reader = arvados.CollectionReader('d41d8cd98f00b204e9800998ecf8427e+0',
+                                          api_client=client)
+        self.assertEqual('', reader.manifest_text())
+
 
 @tutil.skip_sleep
 class CollectionWriterTestCase(unittest.TestCase, CollectionTestMixin):

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


hooks/post-receive
-- 




More information about the arvados-commits mailing list