Fix local storage test failurs under Python 3.2.
Project: http://git-wip-us.apache.org/repos/asf/libcloud/repo Commit: http://git-wip-us.apache.org/repos/asf/libcloud/commit/028bd527 Tree: http://git-wip-us.apache.org/repos/asf/libcloud/tree/028bd527 Diff: http://git-wip-us.apache.org/repos/asf/libcloud/diff/028bd527 Branch: refs/heads/trunk Commit: 028bd5279b89e0b4885ebe067b4a54210c77c8b3 Parents: 8ba5b81 Author: Tomaz Muraus <[email protected]> Authored: Fri Aug 23 14:54:07 2013 +0200 Committer: Tomaz Muraus <[email protected]> Committed: Fri Aug 23 14:54:07 2013 +0200 ---------------------------------------------------------------------- libcloud/storage/drivers/local.py | 3 ++- libcloud/test/storage/test_local.py | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/libcloud/blob/028bd527/libcloud/storage/drivers/local.py ---------------------------------------------------------------------- diff --git a/libcloud/storage/drivers/local.py b/libcloud/storage/drivers/local.py index b341d99..77ddb23 100644 --- a/libcloud/storage/drivers/local.py +++ b/libcloud/storage/drivers/local.py @@ -32,6 +32,7 @@ except ImportError: from libcloud.utils.files import read_in_chunks from libcloud.utils.py3 import relpath +from libcloud.utils.py3 import u from libcloud.common.base import Connection from libcloud.storage.base import Object, Container, StorageDriver from libcloud.common.types import LibcloudError @@ -175,7 +176,7 @@ class LocalStorageDriver(StorageDriver): # use only the mtime attribute here. If the file contents change, # the underlying file-system will change mtime data_hash = self._get_hash_function() - data_hash.update(str(stat.st_mtime)) + data_hash.update(u(stat.st_mtime).encode('ascii')) data_hash = data_hash.hexdigest() extra = {} http://git-wip-us.apache.org/repos/asf/libcloud/blob/028bd527/libcloud/test/storage/test_local.py ---------------------------------------------------------------------- diff --git a/libcloud/test/storage/test_local.py b/libcloud/test/storage/test_local.py index d88c4b7..bb70f38 100644 --- a/libcloud/test/storage/test_local.py +++ b/libcloud/test/storage/test_local.py @@ -310,7 +310,7 @@ class LocalTests(unittest.TestCase): data = '' for buff in stream: - data += buff + data += buff.decode('utf-8') self.assertTrue(len(data), 4096)
