libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject libcloud git commit: Fix test failure under Python 3.
Date Mon, 08 Jan 2018 12:14:21 GMT
Repository: libcloud
Updated Branches:
  refs/heads/trunk 3d8ee16fd -> 8d3e55801


Fix test failure under Python 3.


Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/8d3e5580
Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/8d3e5580
Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/8d3e5580

Branch: refs/heads/trunk
Commit: 8d3e558016329007dc4d289aa1707785e159921a
Parents: 3d8ee16
Author: Tomaz Muraus <tomaz@tomaz.me>
Authored: Mon Jan 8 13:14:05 2018 +0100
Committer: Tomaz Muraus <tomaz@tomaz.me>
Committed: Mon Jan 8 13:14:05 2018 +0100

----------------------------------------------------------------------
 libcloud/test/storage/test_base.py | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/libcloud/blob/8d3e5580/libcloud/test/storage/test_base.py
----------------------------------------------------------------------
diff --git a/libcloud/test/storage/test_base.py b/libcloud/test/storage/test_base.py
index cbcafc5..61bcc42 100644
--- a/libcloud/test/storage/test_base.py
+++ b/libcloud/test/storage/test_base.py
@@ -24,6 +24,7 @@ from mock import Mock
 
 from libcloud.utils.py3 import StringIO
 from libcloud.utils.py3 import b
+from libcloud.utils.py3 import PY2
 
 from libcloud.storage.base import StorageDriver
 from libcloud.storage.base import DEFAULT_CONTENT_TYPE
@@ -182,8 +183,15 @@ class BaseStorageTests(unittest.TestCase):
 
         iterator = iter([str(v) for v in ['b' * size]])
 
-        self.assertFalse(hasattr(iterator, '__next__'))
-        self.assertTrue(hasattr(iterator, 'next'))
+        if PY2:
+            self.assertFalse(hasattr(iterator, '__next__'))
+            self.assertFalse(hasattr(iterator, 'next'))
+        else:
+            self.assertTrue(hasattr(iterator, '__next__'))
+            self.assertFalse(hasattr(iterator, 'next'))
+
+        self.assertEqual(mock_read_in_chunks.call_count, 1)
+        self.assertEqual(mock_exhaust_iterator.call_count, 0)
 
         self.assertEqual(mock_read_in_chunks.call_count, 1)
         self.assertEqual(mock_exhaust_iterator.call_count, 0)


Mime
View raw message