libcloud-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From to...@apache.org
Subject svn commit: r1210013 [2/2] - in /libcloud/trunk: ./ demos/ dist/ libcloud/ libcloud/common/ libcloud/compute/ libcloud/compute/drivers/ libcloud/data/ libcloud/dns/ libcloud/dns/drivers/ libcloud/drivers/ libcloud/loadbalancer/ libcloud/loadbalancer/dr...
Date Sat, 03 Dec 2011 21:39:03 GMT
Modified: libcloud/trunk/libcloud/storage/drivers/atmos.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/storage/drivers/atmos.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/libcloud/storage/drivers/atmos.py (original)
+++ libcloud/trunk/libcloud/storage/drivers/atmos.py Sat Dec  3 21:38:59 2011
@@ -13,15 +13,22 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
+import sys
 import base64
 import hashlib
 import hmac
-import httplib
 import time
-import urllib
-import urlparse
 
-from xml.etree import ElementTree
+from libcloud.py3 import PY3
+from libcloud.py3 import httplib
+from libcloud.py3 import urllib
+from libcloud.py3 import urlparse
+from libcloud.py3 import urlencode
+from libcloud.py3 import next
+from libcloud.py3 import b
+
+if PY3:
+    from io import FileIO as file
 
 from libcloud import utils
 from libcloud.common.base import ConnectionUserAndKey, XmlResponse
@@ -84,7 +91,7 @@ class AtmosConnection(ConnectionUserAndK
         if params:
             if type(params) is dict:
                 params = params.items()
-            pathstring += '?' + urllib.urlencode(params)
+            pathstring += '?' + urlencode(params)
         pathstring = pathstring.lower()
 
         xhdrs = [(k, v) for k, v in headers.items() if k.startswith('x-emc-')]
@@ -100,8 +107,8 @@ class AtmosConnection(ConnectionUserAndK
         signature.extend([k + ':' + collapse(v) for k, v in xhdrs])
         signature = '\n'.join(signature)
         key = base64.b64decode(self.key)
-        signature = hmac.new(key, signature, hashlib.sha1).digest()
-        return base64.b64encode(signature)
+        signature = hmac.new(b(key), b(signature), hashlib.sha1).digest()
+        return base64.b64encode(b(signature))
 
 class AtmosDriver(StorageDriver):
     connectionCls = AtmosConnection
@@ -132,7 +139,8 @@ class AtmosDriver(StorageDriver):
         path = self._namespace_path(container_name + '/?metadata/system')
         try:
             result = self.connection.request(path)
-        except AtmosError, e:
+        except AtmosError:
+            e = sys.exc_info()[1]
             if e.code != 1003:
                 raise
             raise ContainerDoesNotExistError(e, self, container_name)
@@ -146,7 +154,8 @@ class AtmosDriver(StorageDriver):
         path = self._namespace_path(container_name + '/')
         try:
             result = self.connection.request(path, method='POST')
-        except AtmosError, e:
+        except AtmosError:
+            e = sys.exc_info()[1]
             if e.code != 1016:
                 raise
             raise ContainerAlreadyExistsError(e, self, container_name)
@@ -156,7 +165,8 @@ class AtmosDriver(StorageDriver):
         try:
             self.connection.request(self._namespace_path(container.name + '/'),
                                     method='DELETE')
-        except AtmosError, e:
+        except AtmosError:
+            e = sys.exc_info()[1]
             if e.code == 1003:
                 raise ContainerDoesNotExistError(e, self, container.name)
             elif e.code == 1023:
@@ -174,7 +184,8 @@ class AtmosDriver(StorageDriver):
 
             result = self.connection.request(path + '?metadata/user')
             user_meta = self._emc_meta(result)
-        except AtmosError, e:
+        except AtmosError:
+            e = sys.exc_info()[1]
             if e.code != 1003:
                 raise
             raise ObjectDoesNotExistError(e, self, object_name)
@@ -204,7 +215,8 @@ class AtmosDriver(StorageDriver):
 
         try:
             self.connection.request(request_path + '?metadata/system')
-        except AtmosError, e:
+        except AtmosError:
+            e = sys.exc_info()[1]
             if e.code != 1003:
                 raise
             method = 'POST'
@@ -248,7 +260,7 @@ class AtmosDriver(StorageDriver):
         generator = utils.read_in_chunks(iterator, CHUNK_SIZE, True)
         bytes_transferred = 0
         try:
-            chunk = generator.next()
+            chunk = next(generator)
         except StopIteration:
             chunk = ''
 
@@ -256,7 +268,7 @@ class AtmosDriver(StorageDriver):
 
         while True:
             end = bytes_transferred + len(chunk) - 1
-            data_hash.update(chunk)
+            data_hash.update(b(chunk))
             headers = {
                 'x-emc-meta': 'md5=' + data_hash.hexdigest(),
             }
@@ -267,7 +279,7 @@ class AtmosDriver(StorageDriver):
             bytes_transferred += len(chunk)
 
             try:
-                chunk = generator.next()
+                chunk = next(generator)
             except StopIteration:
                 break
             if len(chunk) == 0:
@@ -327,7 +339,8 @@ class AtmosDriver(StorageDriver):
         path = self._namespace_path(obj.container.name + '/' + obj.name)
         try:
             self.connection.request(path, method='DELETE')
-        except AtmosError, e:
+        except AtmosError:
+            e = sys.exc_info()[1]
             if e.code != 1003:
                 raise
             raise ObjectDoesNotExistError(e, self, obj.name)
@@ -358,7 +371,7 @@ class AtmosDriver(StorageDriver):
         ]
         params.append(('signature', self._cdn_signature(path, params)))
 
-        params = urllib.urlencode(params)
+        params = urlencode(params)
         path = self.path + path
         return urlparse.urlunparse((protocol, self.host, path, '', params, ''))
 

Modified: libcloud/trunk/libcloud/storage/drivers/cloudfiles.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/storage/drivers/cloudfiles.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/libcloud/storage/drivers/cloudfiles.py (original)
+++ libcloud/trunk/libcloud/storage/drivers/cloudfiles.py Sat Dec  3 21:38:59 2011
@@ -13,14 +13,21 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import httplib
-import urllib
+from libcloud.py3 import httplib
+from libcloud.py3 import urllib
 
 try:
     import simplejson as json
 except ImportError:
     import json
 
+from libcloud.py3 import PY3
+from libcloud.py3 import urlquote
+
+if PY3:
+    from io import FileIO as file
+
+
 from libcloud.utils import read_in_chunks
 from libcloud.common.types import MalformedResponseError, LibcloudError
 from libcloud.common.base import Response, RawResponse
@@ -383,7 +390,7 @@ class CloudFilesStorageDriver(StorageDri
 
         headers = {}
         if meta_data:
-            for key, value in meta_data.iteritems():
+            for key, value in meta_data.items():
                 key = 'X-Object-Meta-%s' % (key)
                 headers[key] = value
 
@@ -430,7 +437,7 @@ class CloudFilesStorageDriver(StorageDri
         """
         if name.startswith('/'):
             name = name[1:]
-        name = urllib.quote(name)
+        name = urlquote(name)
 
         if name.find('/') != -1:
             raise InvalidContainerNameError(value='Container name cannot'
@@ -446,7 +453,7 @@ class CloudFilesStorageDriver(StorageDri
         return name
 
     def _clean_object_name(self, name):
-        name = urllib.quote(name)
+        name = urlquote(name)
         return name
 
     def _to_container_list(self, response):
@@ -492,7 +499,7 @@ class CloudFilesStorageDriver(StorageDri
         content_type = headers.pop('content-type', None)
 
         meta_data = {}
-        for key, value in headers.iteritems():
+        for key, value in headers.items():
             if key.find('x-object-meta-') != -1:
                 key = key.replace('x-object-meta-', '')
                 meta_data[key] = value

Modified: libcloud/trunk/libcloud/storage/drivers/dummy.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/storage/drivers/dummy.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/libcloud/storage/drivers/dummy.py (original)
+++ libcloud/trunk/libcloud/storage/drivers/dummy.py Sat Dec  3 21:38:59 2011
@@ -17,6 +17,12 @@ import os.path
 import random
 import hashlib
 
+from libcloud.py3 import PY3
+from libcloud.py3 import b
+
+if PY3:
+    from io import FileIO as file
+
 from libcloud.common.types import LibcloudError
 
 from libcloud.storage.base import Object, Container, StorageDriver
@@ -61,10 +67,14 @@ class DummyIterator(object):
             raise StopIteration
 
         value = self._data[self._current_item]
-        self.hash.update(value)
+        self.hash.update(b(value))
         self._current_item += 1
         return value
 
+    def __next__(self):
+        return self.next()
+
+
 class DummyStorageDriver(StorageDriver):
     """
     Dummy Storage driver.
@@ -105,7 +115,7 @@ class DummyStorageDriver(StorageDriver):
         bytes_used = 0
         for container in self._containers:
             objects = self._containers[container]['objects']
-            for _, obj in objects.iteritems():
+            for _, obj in objects.items():
                 bytes_used += obj.size
 
         return { 'container_count': int(container_count),
@@ -318,7 +328,7 @@ class DummyStorageDriver(StorageDriver):
         ...    iterator=DummyFileObject(5, 10), extra={})
         >>> stream = container.download_object_as_stream(obj)
         >>> stream #doctest: +ELLIPSIS
-        <closed file ..., mode '<uninitialized file>' at 0x...>
+        <...closed...>
         """
 
         return DummyFileObject()

Modified: libcloud/trunk/libcloud/storage/drivers/google_storage.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/storage/drivers/google_storage.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/libcloud/storage/drivers/google_storage.py (original)
+++ libcloud/trunk/libcloud/storage/drivers/google_storage.py Sat Dec  3 21:38:59 2011
@@ -14,8 +14,6 @@
 # limitations under the License.
 
 import time
-import httplib
-import urllib
 import copy
 import base64
 import hmac
@@ -23,6 +21,8 @@ import hmac
 from hashlib import sha1
 from email.utils import formatdate
 
+from libcloud.py3 import b
+
 from libcloud.common.base import ConnectionUserAndKey
 
 from libcloud.storage.drivers.s3 import S3StorageDriver, S3Response
@@ -81,7 +81,7 @@ class GoogleStorageConnection(Connection
         extension_header_values = {}
 
         headers_copy = copy.deepcopy(headers)
-        for key, value in headers_copy.iteritems():
+        for key, value in headers_copy.items():
             if key.lower() in special_header_keys:
                 if key.lower() == 'date':
                     value = value.strip()
@@ -97,7 +97,7 @@ class GoogleStorageConnection(Connection
         if not 'content-type' in special_header_values:
             special_header_values['content-type'] = ''
 
-        keys_sorted = special_header_values.keys()
+        keys_sorted = list(special_header_values.keys())
         keys_sorted.sort()
 
         buf = [method]
@@ -106,7 +106,7 @@ class GoogleStorageConnection(Connection
             buf.append(value)
         string_to_sign = '\n'.join(buf)
 
-        keys_sorted = extension_header_values.keys()
+        keys_sorted = list(extension_header_values.keys())
         keys_sorted.sort()
 
         extension_header_string = []
@@ -122,7 +122,7 @@ class GoogleStorageConnection(Connection
 
         string_to_sign = '\n'.join(values_to_sign)
         b64_hmac = base64.b64encode(
-            hmac.new(secret_key, string_to_sign, digestmod=sha1).digest()
+            hmac.new(b(secret_key), b(string_to_sign), digestmod=sha1).digest()
         )
         return b64_hmac
 

Modified: libcloud/trunk/libcloud/storage/drivers/s3.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/storage/drivers/s3.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/libcloud/storage/drivers/s3.py (original)
+++ libcloud/trunk/libcloud/storage/drivers/s3.py Sat Dec  3 21:38:59 2011
@@ -14,8 +14,6 @@
 # limitations under the License.
 
 import time
-import httplib
-import urllib
 import copy
 import base64
 import hmac
@@ -23,6 +21,12 @@ import hmac
 from hashlib import sha1
 from xml.etree.ElementTree import Element, SubElement, tostring
 
+from libcloud.py3 import PY3
+from libcloud.py3 import httplib
+from libcloud.py3 import urllib
+from libcloud.py3 import urlquote
+from libcloud.py3 import b
+
 from libcloud.utils import fixxpath, findtext, in_development_warning
 from libcloud.utils import read_in_chunks
 from libcloud.common.types import InvalidCredsError, LibcloudError
@@ -114,22 +118,22 @@ class S3Connection(ConnectionUserAndKey)
         amz_header_values = {}
 
         headers_copy = copy.deepcopy(headers)
-        for key, value in headers_copy.iteritems():
+        for key, value in headers_copy.items():
             if key.lower() in special_header_keys:
                 special_header_values[key.lower()] = value.lower().strip()
             elif key.lower().startswith('x-amz-'):
                 amz_header_values[key.lower()] = value.strip()
 
-        if not special_header_values.has_key('content-md5'):
+        if not 'content-md5' in special_header_values:
             special_header_values['content-md5'] = ''
 
-        if not special_header_values.has_key('content-type'):
+        if not 'content-type' in special_header_values:
             special_header_values['content-type'] = ''
 
         if expires:
             special_header_values['date'] = str(expires)
 
-        keys_sorted = special_header_values.keys()
+        keys_sorted = list(special_header_values.keys())
         keys_sorted.sort()
 
         buf = [ method ]
@@ -138,7 +142,7 @@ class S3Connection(ConnectionUserAndKey)
             buf.append(value)
         string_to_sign = '\n'.join(buf)
 
-        keys_sorted = amz_header_values.keys()
+        keys_sorted = list(amz_header_values.keys())
         keys_sorted.sort()
 
         amz_header_string = []
@@ -154,7 +158,7 @@ class S3Connection(ConnectionUserAndKey)
 
         string_to_sign = '\n'.join(values_to_sign)
         b64_hmac = base64.b64encode(
-            hmac.new(secret_key, string_to_sign, digestmod=sha1).digest()
+            hmac.new(b(secret_key), b(string_to_sign), digestmod=sha1).digest()
         )
         return b64_hmac
 
@@ -214,7 +218,12 @@ class S3StorageDriver(StorageDriver):
             root = Element('CreateBucketConfiguration')
             child = SubElement(root, 'LocationConstraint')
             child.text = self.ex_location_name
-            data = tostring(root)
+
+            if PY3:
+                encoding = 'unicode'
+            else:
+                encoding = None
+            data = tostring(root, encoding=encoding)
         else:
             data = ''
 
@@ -329,7 +338,7 @@ class S3StorageDriver(StorageDriver):
         return False
 
     def _clean_object_name(self, name):
-        name = urllib.quote(name)
+        name = urlquote(name)
         return name
 
     def _get_more(self, last_key, value_dict):
@@ -375,7 +384,7 @@ class S3StorageDriver(StorageDriver):
         meta_data = extra.get('meta_data', None)
 
         if meta_data:
-            for key, value in meta_data.iteritems():
+            for key, value in meta_data.items():
                 key = 'x-amz-meta-%s' % (key)
                 headers[key] = value
 

Modified: libcloud/trunk/libcloud/utils.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/libcloud/utils.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/libcloud/utils.py (original)
+++ libcloud/trunk/libcloud/utils.py Sat Dec  3 21:38:59 2011
@@ -16,13 +16,19 @@
 import os
 import mimetypes
 import warnings
-from httplib import HTTPResponse
+
+from libcloud.py3 import httplib
+from libcloud.py3 import next
+from libcloud.py3 import PY3
 
 SHOW_DEPRECATION_WARNING = True
 SHOW_IN_DEVELOPMENT_WARNING = True
 OLD_API_REMOVE_VERSION = '0.7.0'
 CHUNK_SIZE = 8096
 
+if PY3:
+    from io import FileIO as file
+
 
 def read_in_chunks(iterator, chunk_size=None, fill_size=False):
     """
@@ -41,12 +47,12 @@ def read_in_chunks(iterator, chunk_size=
     """
     chunk_size = chunk_size or CHUNK_SIZE
 
-    if isinstance(iterator, (file, HTTPResponse)):
+    if isinstance(iterator, (file, httplib.HTTPResponse)):
         get_data = iterator.read
         args = (chunk_size, )
     else:
-        get_data = iterator.next
-        args = ()
+        get_data = next
+        args = (iterator, )
 
     data = ''
     empty = False
@@ -88,7 +94,7 @@ def exhaust_iterator(iterator):
     data = ''
 
     try:
-        chunk = str(iterator.next())
+        chunk = str(next(iterator))
     except StopIteration:
         chunk = ''
 
@@ -96,7 +102,7 @@ def exhaust_iterator(iterator):
         data += chunk
 
         try:
-            chunk = str(iterator.next())
+            chunk = str(next(iterator))
         except StopIteration:
             chunk = ''
 
@@ -246,7 +252,7 @@ def findall(element, xpath, namespace=No
 
 
 def reverse_dict(dictionary):
-    return dict([(value, key) for key, value in dictionary.iteritems()])
+    return dict([(value, key) for key, value in dictionary.items()])
 
 
 def get_driver(drivers, provider):

Modified: libcloud/trunk/setup.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/setup.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/setup.py (original)
+++ libcloud/trunk/setup.py Sat Dec  3 21:38:59 2011
@@ -63,9 +63,9 @@ class TestCommand(Command):
             import mock
             mock
         except ImportError:
-            print 'Missing "mock" library. mock is library is needed ' + \
-                  'to run the tests. You can install it using pip: ' + \
-                  'pip install mock'
+            print('Missing "mock" library. mock is library is needed '
+                 'to run the tests. You can install it using pip: '
+                 'pip install mock')
             sys.exit(1)
 
         status = self._run_tests()
@@ -74,9 +74,9 @@ class TestCommand(Command):
     def _run_tests(self):
         secrets = pjoin(self._dir, 'test', 'secrets.py')
         if not os.path.isfile(secrets):
-            print "Missing %s" % (secrets)
-            print "Maybe you forgot to copy it from -dist:"
-            print "  cp test/secrets.py-dist test/secrets.py"
+            print("Missing " + secrets)
+            print("Maybe you forgot to copy it from -dist:")
+            print("  cp test/secrets.py-dist test/secrets.py")
             sys.exit(1)
 
         pre_python26 = (sys.version_info[0] == 2
@@ -97,7 +97,7 @@ class TestCommand(Command):
                 missing.append("ssl")
 
             if missing:
-                print "Missing dependencies: %s" % ", ".join(missing)
+                print("Missing dependencies: " + ", ".join(missing))
                 sys.exit(1)
 
         testfiles = []
@@ -131,8 +131,8 @@ class Pep8Command(Command):
             import pep8
             pep8
         except ImportError:
-            print 'Missing "pep8" library. You can install it using pip: ' + \
-                  'pip install pep8'
+            print ('Missing "pep8" library. You can install it using pip: '
+                  'pip install pep8')
             sys.exit(1)
 
         cwd = os.getcwd()

Propchange: libcloud/trunk/test/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Modified: libcloud/trunk/test/__init__.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/__init__.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/__init__.py (original)
+++ libcloud/trunk/test/__init__.py Sat Dec  3 21:38:59 2011
@@ -13,14 +13,17 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import httplib
 import random
 import unittest
 
-from cStringIO import StringIO
-from urllib2 import urlparse
 from cgi import parse_qs
 
+from libcloud.py3 import httplib
+from libcloud.py3 import StringIO
+from libcloud.py3 import urlparse
+from libcloud.py3 import u
+
+
 XML_HEADERS = {'content-type': 'application/xml'}
 
 
@@ -75,7 +78,7 @@ class MockResponse(object):
 
     def __init__(self, status, body, headers=None, reason=None):
         self.status = status
-        self.body = StringIO(body)
+        self.body = StringIO(u(body))
         self.headers = headers or self.headers
         self.reason = reason or self.reason
 
@@ -240,6 +243,9 @@ class MockRawResponse(BaseMockHttpObject
         self._current_item += 1
         return value
 
+    def __next__(self):
+        return self.next()
+
     def _generate_random_data(self, size):
         data = []
         current_size = 0

Propchange: libcloud/trunk/test/common/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Modified: libcloud/trunk/test/common/test_cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/common/test_cloudstack.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/common/test_cloudstack.py (original)
+++ libcloud/trunk/test/common/test_cloudstack.py Sat Dec  3 21:38:59 2011
@@ -1,13 +1,15 @@
-import httplib
 import sys
 import unittest
-import urlparse
 
 try:
     import simplejson as json
 except ImportError:
     import json
 
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
+from libcloud.py3 import b
+
 try:
     parse_qsl = urlparse.parse_qsl
 except AttributeError:
@@ -42,7 +44,8 @@ class CloudStackCommonTest(unittest.Test
         self.driver.path = '/bad/response'
         try:
             self.connection._sync_request('fake')
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertTrue(isinstance(e, MalformedResponseError))
             return
         self.assertTrue(False)
@@ -103,7 +106,7 @@ class CloudStackCommonTest(unittest.Test
         connection = CloudStackConnection('fnord', 'abracadabra')
         for case in cases:
             params = connection.add_default_params(case[0])
-            self.assertEqual(connection._make_signature(params), case[1])
+            self.assertEqual(connection._make_signature(params), b(case[1]))
 
 class CloudStackMockHttp(MockHttpTestCase):
     def _response(self, status, result, response):

Propchange: libcloud/trunk/test/compute/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/bluebox/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/brightbox/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/cloudsigma/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/cloudstack/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/ec2/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/ecp/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/elastichosts/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/gandi/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/gogrid/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/ibm_sbc/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/meta/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/opennebula_1_4/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/opennebula_2_0/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/openstack/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/openstack_v1.1/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/opsource/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/rimuhosting/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/slicehost/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/softlayer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/terremark/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/compute/fixtures/voxel/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Modified: libcloud/trunk/test/compute/test_bluebox.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_bluebox.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_bluebox.py (original)
+++ libcloud/trunk/test/compute/test_bluebox.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.drivers.bluebox import BlueboxNodeDriver as Bluebox
 from libcloud.compute.base import Node, NodeAuthPassword

Modified: libcloud/trunk/test/compute/test_brightbox.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_brightbox.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_brightbox.py (original)
+++ libcloud/trunk/test/compute/test_brightbox.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 try:
     import simplejson as json

Modified: libcloud/trunk/test/compute/test_cloudsigma.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_cloudsigma.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_cloudsigma.py (original)
+++ libcloud/trunk/test/compute/test_cloudsigma.py Sat Dec  3 21:38:59 2011
@@ -15,7 +15,7 @@
 
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.base import Node
 from libcloud.compute.drivers.cloudsigma import CloudSigmaZrhNodeDriver
@@ -88,8 +88,8 @@ class CloudSigmaTestCase(unittest.TestCa
     def test_ex_static_ip_create(self):
         result = self.driver.ex_static_ip_create()
         self.assertEqual(len(result), 2)
-        self.assertEqual(len(result[0].keys()), 6)
-        self.assertEqual(len(result[1].keys()), 6)
+        self.assertEqual(len(list(result[0].keys())), 6)
+        self.assertEqual(len(list(result[1].keys())), 6)
 
     def test_ex_static_ip_destroy(self):
         result = self.driver.ex_static_ip_destroy('1.2.3.4')

Modified: libcloud/trunk/test/compute/test_cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_cloudstack.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_cloudstack.py (original)
+++ libcloud/trunk/test/compute/test_cloudstack.py Sat Dec  3 21:38:59 2011
@@ -1,7 +1,8 @@
-import httplib
 import sys
 import unittest
-import urlparse
+
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
 
 try:
     import simplejson as json

Modified: libcloud/trunk/test/compute/test_deployment.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_deployment.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_deployment.py (original)
+++ libcloud/trunk/test/compute/test_deployment.py Sat Dec  3 21:38:59 2011
@@ -17,7 +17,9 @@
 import sys
 import time
 import unittest
-import httplib
+
+from libcloud.py3 import httplib
+from libcloud.py3 import u
 
 from libcloud.compute.deployment import MultiStepDeployment, Deployment
 from libcloud.compute.deployment import SSHKeyDeployment, ScriptDeployment
@@ -99,11 +101,11 @@ class DeploymentTests(unittest.TestCase)
                 return 'bar'
 
         ScriptDeployment(script='foobar')
-        ScriptDeployment(script=unicode('foobar'))
+        ScriptDeployment(script=u('foobar'))
         ScriptDeployment(script=FileObject('test'))
 
         SSHKeyDeployment(key='foobar')
-        SSHKeyDeployment(key=unicode('foobar'))
+        SSHKeyDeployment(key=u('foobar'))
         SSHKeyDeployment(key=FileObject('test'))
 
         try:
@@ -137,7 +139,8 @@ class DeploymentTests(unittest.TestCase)
         try:
             self.driver._wait_until_running(node=self.node, wait_period=0.5,
                                             timeout=1)
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.value.find('Timed out') != -1)
         else:
             self.fail('Exception was not thrown')
@@ -149,7 +152,8 @@ class DeploymentTests(unittest.TestCase)
         try:
             self.driver._wait_until_running(node=self.node, wait_period=0.5,
                                             timeout=1)
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.value.find('is missing from list_nodes') != -1)
         else:
             self.fail('Exception was not thrown')
@@ -160,7 +164,8 @@ class DeploymentTests(unittest.TestCase)
         try:
             self.driver._wait_until_running(node=self.node, wait_period=0.5,
                                             timeout=1)
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.value.find('multiple nodes have same UUID') != -1)
         else:
             self.fail('Exception was not thrown')
@@ -182,7 +187,8 @@ class DeploymentTests(unittest.TestCase)
         try:
             self.driver._ssh_client_connect(ssh_client=mock_ssh_client,
                                             timeout=1)
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.value.find('Giving up') != -1)
         else:
             self.fail('Exception was not thrown')
@@ -208,7 +214,8 @@ class DeploymentTests(unittest.TestCase)
                                                node=self.node,
                                                ssh_client=ssh_client,
                                                max_tries=2)
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.value.find('Failed after 2 tries') != -1)
         else:
             self.fail('Exception was not thrown')
@@ -239,7 +246,8 @@ class DeploymentTests(unittest.TestCase)
 
         try:
             self.driver.deploy_node(deploy=deploy)
-        except DeploymentError, e:
+        except DeploymentError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.node.id, self.node.id)
         else:
             self.fail('Exception was not thrown')
@@ -258,7 +266,8 @@ class DeploymentTests(unittest.TestCase)
 
         try:
             self.driver.deploy_node(deploy=deploy)
-        except DeploymentError, e:
+        except DeploymentError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.node.id, self.node.id)
         else:
             self.fail('Exception was not thrown')
@@ -309,7 +318,8 @@ class DeploymentTests(unittest.TestCase)
 
         try:
             self.driver.deploy_node(deploy=Mock())
-        except RuntimeError, e:
+        except RuntimeError:
+            e = sys.exc_info()[1]
             self.assertTrue(str(e).find('paramiko is not installed') != -1)
         else:
             self.fail('Exception was not thrown')

Modified: libcloud/trunk/test/compute/test_dreamhost.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_dreamhost.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_dreamhost.py (original)
+++ libcloud/trunk/test/compute/test_dreamhost.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 try:
     import simplejson as json
@@ -79,15 +79,15 @@ class DreamhostTest(unittest.TestCase, T
         self.assertEqual(web_node.state, NodeState.UNKNOWN)
         self.assertTrue('75.119.203.51' in web_node.public_ips)
         self.assertTrue(
-            web_node.extra.has_key('current_size') and
+            'current_size' in web_node.extra and
             web_node.extra['current_size'] == 500
         )
         self.assertTrue(
-            web_node.extra.has_key('account_id') and
+            'account_id' in web_node.extra and
             web_node.extra['account_id'] == 000000
         )
         self.assertTrue(
-            web_node.extra.has_key('type') and
+            'type' in web_node.extra and
             web_node.extra['type'] == 'web'
         )
         # MySql node tests
@@ -95,15 +95,15 @@ class DreamhostTest(unittest.TestCase, T
         self.assertEqual(mysql_node.state, NodeState.UNKNOWN)
         self.assertTrue('75.119.203.52' in mysql_node.public_ips)
         self.assertTrue(
-            mysql_node.extra.has_key('current_size') and
+            'current_size' in mysql_node.extra and
             mysql_node.extra['current_size'] == 1500
         )
         self.assertTrue(
-            mysql_node.extra.has_key('account_id') and
+            'account_id' in mysql_node.extra and
             mysql_node.extra['account_id'] == 000000
         )
         self.assertTrue(
-            mysql_node.extra.has_key('type') and
+            'type' in mysql_node.extra and
             mysql_node.extra['type'] == 'mysql'
         )
 
@@ -124,7 +124,7 @@ class DreamhostTest(unittest.TestCase, T
         self.assertEqual(new_node.id, 'ps12345')
         self.assertEqual(new_node.state, NodeState.PENDING)
         self.assertTrue(
-            new_node.extra.has_key('type') and
+            'type' in new_node.extra and
             new_node.extra['type'] == 'web'
         )
 

Modified: libcloud/trunk/test/compute/test_ec2.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_ec2.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_ec2.py (original)
+++ libcloud/trunk/test/compute/test_ec2.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,8 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+
+from libcloud.py3 import httplib
 
 from libcloud.compute.drivers.ec2 import EC2NodeDriver, EC2APSENodeDriver
 from libcloud.compute.drivers.ec2 import NimbusNodeDriver, EucNodeDriver
@@ -78,7 +79,8 @@ class EC2Tests(LibcloudTestCase, TestCas
             self.driver.create_node(name='foo', image=image, size=size,
                     ex_mincount='2', ex_maxcount='2',
                     ex_clienttoken=token)
-        except IdempotentParamError, e:
+        except IdempotentParamError:
+            e = sys.exc_info()[1]
             idem_error = e
         self.assertTrue(idem_error is not None)
 

Modified: libcloud/trunk/test/compute/test_ecp.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_ecp.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_ecp.py (original)
+++ libcloud/trunk/test/compute/test_ecp.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.drivers.ecp import ECPNodeDriver
 from libcloud.compute.types import NodeState

Modified: libcloud/trunk/test/compute/test_elasticstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_elasticstack.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_elasticstack.py (original)
+++ libcloud/trunk/test/compute/test_elasticstack.py Sat Dec  3 21:38:59 2011
@@ -15,7 +15,7 @@
 
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.base import Node
 from libcloud.compute.types import Provider
@@ -57,7 +57,8 @@ class ElasticStackTestCase(object):
         self.mockHttp.type = 'UNAUTHORIZED'
         try:
             self.driver.list_nodes()
-        except InvalidCredsError, e:
+        except InvalidCredsError:
+            e = sys.exc_info()[1]
             self.assertEqual(True, isinstance(e, InvalidCredsError))
         else:
             self.fail('test should have thrown')
@@ -75,7 +76,8 @@ class ElasticStackTestCase(object):
         self.mockHttp.type = 'PARSE_ERROR'
         try:
             self.driver.list_nodes()
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertTrue(str(e).find('X-Elastic-Error') != -1)
         else:
             self.fail('test should have thrown')
@@ -119,7 +121,7 @@ class ElasticStackTestCase(object):
         images = self.driver.list_images()
         self.assertEqual(len(images), len(self.driver._standard_drives))
 
-        for uuid, values in self.driver._standard_drives.iteritems():
+        for uuid, values in self.driver._standard_drives.items():
             self.assertEqual(len([image for image in images if image.id == uuid]), 1)
 
     def test_reboot_node(self):

Modified: libcloud/trunk/test/compute/test_gandi.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_gandi.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_gandi.py (original)
+++ libcloud/trunk/test/compute/test_gandi.py Sat Dec  3 21:38:59 2011
@@ -17,8 +17,9 @@ import unittest
 import sys
 import random
 import string
-import httplib
-import xmlrpclib
+
+from libcloud.py3 import httplib
+from libcloud.py3 import xmlrpclib
 
 from libcloud.compute.drivers.gandi import GandiNodeDriver as Gandi
 from libcloud.common.gandi import GandiException
@@ -60,13 +61,13 @@ class GandiTests(unittest.TestCase):
         self.assertTrue(len(nodes) > 0)
 
     def test_list_locations(self):
-        loc = filter(lambda x: 'france' in x.country.lower(),
-            self.driver.list_locations())[0]
+        loc = list(filter(lambda x: 'france' in x.country.lower(),
+            self.driver.list_locations()))[0]
         self.assertEqual(loc.country, 'France')
 
     def test_list_images(self):
-        loc = filter(lambda x: 'france' in x.country.lower(),
-            self.driver.list_locations())[0]
+        loc = list(filter(lambda x: 'france' in x.country.lower(),
+            self.driver.list_locations()))[0]
         images = self.driver.list_images(loc)
         self.assertTrue(len(images) > 2)
 
@@ -76,30 +77,31 @@ class GandiTests(unittest.TestCase):
 
     def test_destroy_node_running(self):
         nodes = self.driver.list_nodes()
-        test_node = filter(lambda x: x.state == NodeState.RUNNING, nodes)[0]
+        test_node = list(filter(lambda x: x.state == NodeState.RUNNING, nodes))[0]
         self.assertTrue(self.driver.destroy_node(test_node))
 
     def test_destroy_node_halted(self):
         nodes = self.driver.list_nodes()
-        test_node = filter(lambda x: x.state == NodeState.TERMINATED, nodes)[0]
+        test_node = list(filter(lambda x: x.state == NodeState.TERMINATED,
+                                nodes))[0]
         self.assertTrue(self.driver.destroy_node(test_node))
 
     def test_reboot_node(self):
         nodes = self.driver.list_nodes()
-        test_node = filter(lambda x: x.state == NodeState.RUNNING, nodes)[0]
+        test_node = list(filter(lambda x: x.state == NodeState.RUNNING, nodes))[0]
         self.assertTrue(self.driver.reboot_node(test_node))
 
     def test_create_node(self):
         login = 'libcloud'
-        passwd = ''.join(random.choice(string.letters + string.digits)
-            for i in xrange(10))
+        passwd = ''.join(random.choice(string.ascii_letters)
+            for i in range(10))
         # Get france datacenter
-        loc = filter(lambda x: 'france' in x.country.lower(),
-            self.driver.list_locations())[0]
+        loc = list(filter(lambda x: 'france' in x.country.lower(),
+            self.driver.list_locations()))[0]
         # Get a debian image
         images = self.driver.list_images(loc)
         images = [x for x in images if x.name.lower().startswith('debian')]
-        img = filter(lambda x: '5' in x.name, images)[0]
+        img = list(filter(lambda x: '5' in x.name, images))[0]
         # Get a configuration size
         size = self.driver.list_sizes()[0]
         node = self.driver.create_node(name=self.node_name, login=login,

Modified: libcloud/trunk/test/compute/test_gogrid.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_gogrid.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_gogrid.py (original)
+++ libcloud/trunk/test/compute/test_gogrid.py Sat Dec  3 21:38:59 2011
@@ -12,10 +12,11 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 # limitations under the License.
-import httplib
 import sys
 import unittest
-import urlparse
+
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
 
 from libcloud.compute.base import NodeState, NodeLocation
 from libcloud.common.types import LibcloudError, InvalidCredsError
@@ -101,7 +102,8 @@ class GoGridTests(unittest.TestCase, Tes
         GoGridMockHttp.type = 'FAIL'
         try:
             self.driver.list_images()
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(isinstance(e, LibcloudError))
         else:
             self.fail("test should have thrown")
@@ -110,7 +112,8 @@ class GoGridTests(unittest.TestCase, Tes
         GoGridMockHttp.type = 'FAIL'
         try:
             self.driver.list_nodes()
-        except InvalidCredsError, e:
+        except InvalidCredsError:
+            e = sys.exc_info()[1]
             self.assertTrue(e.driver is not None)
             self.assertEqual(e.driver.name, self.driver.name)
         else:
@@ -124,7 +127,8 @@ class GoGridTests(unittest.TestCase, Tes
                 name='test1',
                 image=image,
                 size=self._get_test_512Mb_node_size())
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(isinstance(e, LibcloudError))
             self.assertTrue(e.driver is not None)
             self.assertEqual(e.driver.name, self.driver.name)

Modified: libcloud/trunk/test/compute/test_ibm_sbc.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_ibm_sbc.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_ibm_sbc.py (original)
+++ libcloud/trunk/test/compute/test_ibm_sbc.py Sat Dec  3 21:38:59 2011
@@ -12,7 +12,7 @@
 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 # See the License for the specific language governing permissions and
 import unittest
-import httplib
+from libcloud.py3 import httplib
 import sys
 
 from libcloud.compute.types import InvalidCredsError
@@ -39,7 +39,8 @@ class IBMTests(unittest.TestCase, TestCa
 
         try:
             self.driver.list_nodes()
-        except InvalidCredsError, e:
+        except InvalidCredsError:
+            e = sys.exc_info()[1]
             self.assertTrue(isinstance(e, InvalidCredsError))
             self.assertEquals(e.value, '401: Unauthorized')
         else:
@@ -109,7 +110,8 @@ class IBMTests(unittest.TestCase, TestCa
                                                'insight_admin_password': 'myPassword1',
                                                'db2_admin_password': 'myPassword2',
                                                'report_user_password': 'myPassword3'})
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertEquals(e.args[0], 'Error 412: No DataCenter with id: 3')
         else:
             self.fail('test should have thrown')
@@ -129,7 +131,8 @@ class IBMTests(unittest.TestCase, TestCa
         self.assertEquals(len(nodes), 2)
         try:
             self.driver.destroy_node(toDelete)      # delete non-existent node
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertEquals(e.args[0], 'Error 404: Invalid Instance ID 28193')
         else:
             self.fail('test should have thrown')
@@ -146,7 +149,8 @@ class IBMTests(unittest.TestCase, TestCa
         # Reboot inactive node
         try:
             ret = self.driver.reboot_node(nodes[1])
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertEquals(e.args[0], 'Error 412: Instance must be in the Active state')
         else:
             self.fail('test should have thrown')

Modified: libcloud/trunk/test/compute/test_linode.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_linode.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_linode.py (original)
+++ libcloud/trunk/test/compute/test_linode.py Sat Dec  3 21:38:59 2011
@@ -19,7 +19,7 @@
 
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.drivers.linode import LinodeNodeDriver
 from libcloud.compute.base import Node, NodeAuthPassword

Modified: libcloud/trunk/test/compute/test_opennebula.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_opennebula.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_opennebula.py (original)
+++ libcloud/trunk/test/compute/test_opennebula.py Sat Dec  3 21:38:59 2011
@@ -23,9 +23,10 @@ OpenNebula.org test suite.
 __docformat__ = 'epytext'
 
 import unittest
-import httplib
 import sys
 
+from libcloud.py3 import httplib
+
 from libcloud.compute.base import Node, NodeImage, NodeSize, NodeState
 from libcloud.compute.drivers.opennebula import *
 

Modified: libcloud/trunk/test/compute/test_openstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_openstack.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_openstack.py (original)
+++ libcloud/trunk/test/compute/test_openstack.py Sat Dec  3 21:38:59 2011
@@ -15,7 +15,10 @@
 import sys
 import unittest
 import types
-import httplib
+
+from libcloud.py3 import httplib
+from libcloud.py3 import method_type
+from libcloud.py3 import u
 
 from libcloud.common.types import InvalidCredsError, MalformedResponseError
 from libcloud.compute.types import Provider
@@ -84,7 +87,8 @@ class OpenStack_1_0_Tests(unittest.TestC
         OpenStackMockHttp.type = 'UNAUTHORIZED'
         try:
             self.driver = self.create_driver()
-        except InvalidCredsError, e:
+        except InvalidCredsError:
+            e = sys.exc_info()[1]
             self.assertEqual(True, isinstance(e, InvalidCredsError))
         else:
             self.fail('test should have thrown')
@@ -93,7 +97,8 @@ class OpenStack_1_0_Tests(unittest.TestC
         OpenStackMockHttp.type = 'UNAUTHORIZED_MISSING_KEY'
         try:
             self.driver = self.create_driver()
-        except MalformedResponseError, e:
+        except MalformedResponseError:
+            e = sys.exc_info()[1]
             self.assertEqual(True, isinstance(e, MalformedResponseError))
         else:
             self.fail('test should have thrown')
@@ -102,7 +107,8 @@ class OpenStack_1_0_Tests(unittest.TestC
         OpenStackMockHttp.type = 'INTERNAL_SERVER_ERROR'
         try:
             self.driver = self.create_driver()
-        except MalformedResponseError, e:
+        except MalformedResponseError:
+            e = sys.exc_info()[1]
             self.assertEqual(True, isinstance(e, MalformedResponseError))
         else:
             self.fail('test should have thrown')
@@ -394,6 +400,7 @@ class OpenStackMockHttp(MockHttpTestCase
     def _v1_0_slug_servers_EX_SHARED_IP_GROUP(self, method, url, body, headers):
         # test_create_node_ex_shared_ip_group
         # Verify that the body contains sharedIpGroupId XML element
+        body = u(body)
         self.assertTrue(body.find('sharedIpGroupId="12345"') != -1)
         body = self.fixtures.load('v1_slug_servers.xml')
         return (httplib.ACCEPTED, body, XML_HEADERS, httplib.responses[httplib.ACCEPTED])
@@ -441,6 +448,7 @@ class OpenStackMockHttp(MockHttpTestCase
         return (httplib.ACCEPTED, "", {}, httplib.responses[httplib.ACCEPTED])
 
     def _v1_0_slug_servers_444222_action(self, method, url, body, headers):
+        body = u(body)
         if body.find('resize') != -1:
             # test_ex_resize_server
             return (httplib.ACCEPTED, "", headers, httplib.responses[httplib.NO_CONTENT])
@@ -564,14 +572,16 @@ class OpenStack_1_1_Tests(unittest.TestC
     def test_ex_set_password(self):
         try:
             self.driver.ex_set_password(self.node, 'New1&53jPass')
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.fail('An error was raised: ' + repr(e))
 
     def test_ex_rebuild(self):
         image = NodeImage(id=11, name='Ubuntu 8.10 (intrepid)', driver=self.driver)
         try:
             self.driver.ex_rebuild(self.node, image=image)
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.fail('An error was raised: ' + repr(e))
 
     def test_ex_resize(self):
@@ -579,19 +589,22 @@ class OpenStack_1_1_Tests(unittest.TestC
                         driver=self.driver)
         try:
             self.driver.ex_resize(self.node, size)
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.fail('An error was raised: ' + repr(e))
 
     def test_ex_confirm_resize(self):
         try:
             self.driver.ex_confirm_resize(self.node)
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.fail('An error was raised: ' + repr(e))
 
     def test_ex_revert_resize(self):
         try:
             self.driver.ex_revert_resize(self.node)
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.fail('An error was raised: ' + repr(e))
 
     def test_ex_save_image(self):
@@ -803,13 +816,13 @@ class OpenStack_1_1_Auth_2_0_MockHttp(Op
         for name in names1:
             method = methods1[name]
             new_name = name.replace('_v1_0_slug_', '_v1_0_1337_')
-            setattr(self, new_name, types.MethodType(method, self,
+            setattr(self, new_name, method_type(method, self,
                 OpenStack_1_1_Auth_2_0_MockHttp))
 
         for name in names2:
             method = methods2[name]
             new_name = name.replace('_v1_1_slug_', '_v1_0_1337_')
-            setattr(self, new_name, types.MethodType(method, self,
+            setattr(self, new_name, method_type(method, self,
                 OpenStack_1_1_Auth_2_0_MockHttp))
 
 

Modified: libcloud/trunk/test/compute/test_opsource.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_opsource.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_opsource.py (original)
+++ libcloud/trunk/test/compute/test_opsource.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.common.types import InvalidCredsError
 from libcloud.compute.drivers.opsource import OpsourceNodeDriver as Opsource

Modified: libcloud/trunk/test/compute/test_rimuhosting.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_rimuhosting.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_rimuhosting.py (original)
+++ libcloud/trunk/test/compute/test_rimuhosting.py Sat Dec  3 21:38:59 2011
@@ -16,7 +16,7 @@
 
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.drivers.rimuhosting import RimuHostingNodeDriver
 

Modified: libcloud/trunk/test/compute/test_slicehost.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_slicehost.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_slicehost.py (original)
+++ libcloud/trunk/test/compute/test_slicehost.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from xml.etree import ElementTree as ET
 
@@ -46,7 +46,8 @@ class SlicehostTest(unittest.TestCase, T
         SlicehostMockHttp.type = 'UNAUTHORIZED'
         try:
             ret = self.driver.list_nodes()
-        except InvalidCredsError, e:
+        except InvalidCredsError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.value, 'HTTP Basic: Access denied.')
         else:
             self.fail('test should have thrown')
@@ -77,7 +78,8 @@ class SlicehostTest(unittest.TestCase, T
         SlicehostMockHttp.type = 'FORBIDDEN'
         try:
             ret = self.driver.reboot_node(node)
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertEqual(e.args[0], 'Permission denied')
         else:
             self.fail('test should have thrown')
@@ -114,7 +116,7 @@ class SlicehostMockHttp(MockHttp):
             # the correct validation logic
             if not (name and image_id and flavor_id) \
                 or tree.tag != 'slice' \
-                or not headers.has_key('Content-Type')  \
+                or not 'Content-Type' in headers  \
                 or headers['Content-Type'] != 'application/xml':
 
                 err_body = self.fixtures.load('slices_error.xml')

Modified: libcloud/trunk/test/compute/test_softlayer.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_softlayer.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_softlayer.py (original)
+++ libcloud/trunk/test/compute/test_softlayer.py Sat Dec  3 21:38:59 2011
@@ -13,12 +13,14 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import httplib
 import unittest
 import sys
 
 from xml.etree import ElementTree as ET
-import xmlrpclib
+
+from libcloud.py3 import httplib
+from libcloud.py3 import xmlrpclib
+from libcloud.py3 import next
 
 from libcloud.compute.drivers.softlayer import SoftLayerNodeDriver as SoftLayer
 from libcloud.compute.types import NodeState
@@ -57,7 +59,7 @@ class SoftLayerTests(unittest.TestCase):
 
     def test_list_locations(self):
         locations = self.driver.list_locations()
-        seattle = (l for l in locations if l.name == 'sea01').next()
+        seattle = next(l for l in locations if l.name == 'sea01')
         self.assertEqual(seattle.country, 'US')
         self.assertEqual(seattle.id, '18171')
 

Modified: libcloud/trunk/test/compute/test_ssh_client.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_ssh_client.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_ssh_client.py (original)
+++ libcloud/trunk/test/compute/test_ssh_client.py Sat Dec  3 21:38:59 2011
@@ -30,7 +30,8 @@ class ParamikoSSHClientTests(unittest.Te
 
         try:
             client.connect()
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertTrue(str(e).find('must specify either password or')
                             != -1)
         else:

Modified: libcloud/trunk/test/compute/test_vcloud.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_vcloud.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_vcloud.py (original)
+++ libcloud/trunk/test/compute/test_vcloud.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.drivers.vcloud import TerremarkDriver
 from libcloud.compute.drivers.vcloud import VCloudNodeDriver

Modified: libcloud/trunk/test/compute/test_voxel.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_voxel.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_voxel.py (original)
+++ libcloud/trunk/test/compute/test_voxel.py Sat Dec  3 21:38:59 2011
@@ -14,7 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.base import Node, NodeSize, NodeImage, NodeLocation
 from libcloud.compute.drivers.voxel import VoxelNodeDriver as Voxel
@@ -37,7 +37,8 @@ class VoxelTest(unittest.TestCase):
         VoxelMockHttp.type = 'UNAUTHORIZED'
         try:
             self.driver.list_nodes()
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertTrue(isinstance(e, InvalidCredsError))
         else:
             self.fail('test should have thrown')

Modified: libcloud/trunk/test/compute/test_vpsnet.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/compute/test_vpsnet.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/compute/test_vpsnet.py (original)
+++ libcloud/trunk/test/compute/test_vpsnet.py Sat Dec  3 21:38:59 2011
@@ -14,8 +14,7 @@
 # limitations under the License.
 import sys
 import unittest
-import exceptions
-import httplib
+from libcloud.py3 import httplib
 
 from libcloud.compute.drivers.vpsnet import VPSNetNodeDriver
 from libcloud.compute.base import Node
@@ -60,7 +59,7 @@ class VPSNetTests(unittest.TestCase, Tes
         self.assertTrue(ret)
         VPSNetMockHttp.type = 'delete_fail'
         node = Node('2223', None, None, None, None, self.driver)
-        self.assertRaises(exceptions.Exception, self.driver.destroy_node, node)
+        self.assertRaises(Exception, self.driver.destroy_node, node)
 
     def test_list_images(self):
         VPSNetMockHttp.type = 'templates'

Propchange: libcloud/trunk/test/dns/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/dns/fixtures/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/dns/fixtures/linode/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/dns/fixtures/rackspace/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/dns/fixtures/zerigo/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Modified: libcloud/trunk/test/dns/test_linode.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/dns/test_linode.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/dns/test_linode.py (original)
+++ libcloud/trunk/test/dns/test_linode.py Sat Dec  3 21:38:59 2011
@@ -13,9 +13,10 @@
 # See the License for the specific language governing permissions and
 
 import sys
-import httplib
 import unittest
 
+from libcloud.py3 import httplib
+
 from libcloud.common.linode import LinodeException
 from libcloud.dns.types import RecordType, ZoneDoesNotExistError
 from libcloud.dns.types import RecordDoesNotExistError
@@ -74,7 +75,8 @@ class LinodeTests(unittest.TestCase):
         LinodeMockHttp.type = 'ZONE_DOES_NOT_EXIST'
         try:
             self.driver.list_records(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -94,7 +96,8 @@ class LinodeTests(unittest.TestCase):
 
         try:
             self.driver.get_zone(zone_id='4444')
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, '4444')
         else:
             self.fail('Exception was not thrown')
@@ -203,7 +206,8 @@ class LinodeTests(unittest.TestCase):
 
         try:
             self.driver.delete_zone(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -222,7 +226,8 @@ class LinodeTests(unittest.TestCase):
 
         try:
             self.driver.delete_record(record=record)
-        except RecordDoesNotExistError, e:
+        except RecordDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.record_id, record.id)
         else:
             self.fail('Exception was not thrown')

Modified: libcloud/trunk/test/dns/test_rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/dns/test_rackspace.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/dns/test_rackspace.py (original)
+++ libcloud/trunk/test/dns/test_rackspace.py Sat Dec  3 21:38:59 2011
@@ -13,9 +13,10 @@
 # See the License for the specific language governing permissions and
 
 import sys
-import httplib
 import unittest
 
+from libcloud.py3 import httplib
+
 from libcloud.common.types import LibcloudError
 from libcloud.dns.types import RecordType, ZoneDoesNotExistError
 from libcloud.dns.types import RecordDoesNotExistError
@@ -88,7 +89,8 @@ class RackspaceUSTests(unittest.TestCase
         RackspaceMockHttp.type = 'ZONE_DOES_NOT_EXIST'
         try:
             self.driver.list_records(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -107,7 +109,8 @@ class RackspaceUSTests(unittest.TestCase
 
         try:
             self.driver.get_zone(zone_id='4444')
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, '4444')
         else:
             self.fail('Exception was not thrown')
@@ -159,7 +162,8 @@ class RackspaceUSTests(unittest.TestCase
             self.driver.create_zone(domain='foo.bar.com', type='master',
                                     ttl=10,
                                     extra={'email': 'test@test.com'})
-        except Exception, e:
+        except Exception:
+            e = sys.exc_info()[1]
             self.assertEqual(str(e), 'Validation errors: Domain TTL is ' +
                                       'required and must be greater than ' +
                                       'or equal to 300')
@@ -231,7 +235,8 @@ class RackspaceUSTests(unittest.TestCase
 
         try:
             self.driver.delete_zone(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -250,7 +255,8 @@ class RackspaceUSTests(unittest.TestCase
 
         try:
             self.driver.delete_record(record=record)
-        except RecordDoesNotExistError, e:
+        except RecordDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.record_id, record.id)
         else:
             self.fail('Exception was not thrown')

Modified: libcloud/trunk/test/dns/test_zerigo.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/dns/test_zerigo.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/dns/test_zerigo.py (original)
+++ libcloud/trunk/test/dns/test_zerigo.py Sat Dec  3 21:38:59 2011
@@ -13,9 +13,10 @@
 # See the License for the specific language governing permissions and
 
 import sys
-import httplib
 import unittest
 
+from libcloud.py3 import httplib
+
 from libcloud.common.types import InvalidCredsError, LibcloudError
 from libcloud.dns.types import RecordType, ZoneDoesNotExistError
 from libcloud.dns.types import RecordDoesNotExistError
@@ -82,7 +83,8 @@ class ZerigoTests(unittest.TestCase):
         ZerigoMockHttp.type = 'ZONE_DOES_NOT_EXIST'
         try:
             list(self.driver.list_records(zone=zone))
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -101,7 +103,8 @@ class ZerigoTests(unittest.TestCase):
 
         try:
             self.driver.get_zone(zone_id='4444')
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, '4444')
         else:
             self.fail('Exception was not thrown')
@@ -148,9 +151,9 @@ class ZerigoTests(unittest.TestCase):
         try:
             self.driver.create_zone(domain='foo.bar.com', type='master',
                                     ttl=10, extra=None)
-        except ZerigoError, e:
+        except ZerigoError:
+            e = sys.exc_info()[1]
             self.assertEqual(len(e.errors), 2)
-            pass
         else:
             self.fail('Exception was not thrown')
 
@@ -220,7 +223,8 @@ class ZerigoTests(unittest.TestCase):
 
         try:
             self.driver.delete_zone(zone=zone)
-        except ZoneDoesNotExistError, e:
+        except ZoneDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.zone_id, zone.id)
         else:
             self.fail('Exception was not thrown')
@@ -239,7 +243,8 @@ class ZerigoTests(unittest.TestCase):
 
         try:
             self.driver.delete_record(record=record)
-        except RecordDoesNotExistError, e:
+        except RecordDoesNotExistError:
+            e = sys.exc_info()[1]
             self.assertEqual(e.record_id, record.id)
         else:
             self.fail('Exception was not thrown')

Modified: libcloud/trunk/test/file_fixtures.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/file_fixtures.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/file_fixtures.py (original)
+++ libcloud/trunk/test/file_fixtures.py Sat Dec  3 21:38:59 2011
@@ -18,6 +18,8 @@ from __future__ import with_statement
 
 import os
 
+from libcloud.py3 import u
+
 FIXTURES_ROOT = {
     'compute': 'compute/fixtures',
     'storage': 'storage/fixtures',
@@ -37,7 +39,7 @@ class FileFixtures(object):
         if os.path.exists(path):
             with open(path, 'r') as fh:
                 content = fh.read()
-            return content
+            return u(content)
         else:
             raise IOError(path)
 

Propchange: libcloud/trunk/test/loadbalancer/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/loadbalancer/fixtures/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/loadbalancer/fixtures/cloudstack/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/loadbalancer/fixtures/gogrid/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/loadbalancer/fixtures/rackspace/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Modified: libcloud/trunk/test/loadbalancer/test_cloudstack.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/loadbalancer/test_cloudstack.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/loadbalancer/test_cloudstack.py (original)
+++ libcloud/trunk/test/loadbalancer/test_cloudstack.py Sat Dec  3 21:38:59 2011
@@ -1,13 +1,14 @@
-import httplib
 import sys
 import unittest
-import urlparse
 
 try:
     import simplejson as json
 except ImportError:
     import json
 
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
+
 try:
     parse_qsl = urlparse.parse_qsl
 except AttributeError:

Modified: libcloud/trunk/test/loadbalancer/test_gogrid.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/loadbalancer/test_gogrid.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/loadbalancer/test_gogrid.py (original)
+++ libcloud/trunk/test/loadbalancer/test_gogrid.py Sat Dec  3 21:38:59 2011
@@ -13,10 +13,11 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import httplib
 import sys
 import unittest
-from urlparse import urlparse
+
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
 
 from libcloud.common.types import LibcloudError
 from libcloud.compute.base import Node
@@ -75,7 +76,8 @@ class GoGridTests(unittest.TestCase):
                     members=(Member(None, '10.1.0.10', 80),
                              Member(None, '10.1.0.11', 80))
                     )
-        except LibcloudError, e:
+        except LibcloudError:
+            e = sys.exc_info()[1]
             self.assertTrue(str(e).find('tried to add a member with an IP address not assigned to your account') != -1)
         else:
             self.fail('Exception was not thrown')
@@ -100,8 +102,8 @@ class GoGridTests(unittest.TestCase):
         members1 = self.driver.balancer_list_members(balancer=balancer)
         members2 = balancer.list_members()
 
-        expected_members = set([u'10.0.0.78:80', u'10.0.0.77:80',
-            u'10.0.0.76:80'])
+        expected_members = set(['10.0.0.78:80', '10.0.0.77:80',
+                                '10.0.0.76:80'])
 
         self.assertEquals(len(members1), 3)
         self.assertEquals(len(members2), 3)
@@ -153,7 +155,7 @@ class GoGridLBMockHttp(MockHttpTestCase)
         return (httplib.OK, body, {}, httplib.responses[httplib.OK])
 
     def _api_grid_loadbalancer_add(self, method, url, body, headers):
-        query = urlparse(url).query
+        query = urlparse.urlparse(url).query
         self.assertTrue(query.find('loadbalancer.type=round+robin') != -1)
 
         body = self.fixtures.load('loadbalancer_add.json')

Modified: libcloud/trunk/test/loadbalancer/test_rackspace.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/loadbalancer/test_rackspace.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/loadbalancer/test_rackspace.py (original)
+++ libcloud/trunk/test/loadbalancer/test_rackspace.py Sat Dec  3 21:38:59 2011
@@ -13,7 +13,6 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import httplib
 import sys
 import unittest
 
@@ -22,6 +21,8 @@ try:
 except ImportError:
     import json
 
+from libcloud.py3 import httplib
+
 from libcloud.loadbalancer.base import Member, Algorithm
 from libcloud.loadbalancer.drivers.rackspace import RackspaceLBDriver
 from libcloud.loadbalancer.drivers.rackspace import RackspaceUKLBDriver

Propchange: libcloud/trunk/test/resource/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/resource/fixtures/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/storage/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/storage/fixtures/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/storage/fixtures/atmos/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/storage/fixtures/cloudfiles/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/storage/fixtures/google_storage/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Propchange: libcloud/trunk/test/storage/fixtures/s3/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Sat Dec  3 21:38:59 2011
@@ -0,0 +1 @@
+__pycache__

Modified: libcloud/trunk/test/storage/test_atmos.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/storage/test_atmos.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/storage/test_atmos.py (original)
+++ libcloud/trunk/test/storage/test_atmos.py Sat Dec  3 21:38:59 2011
@@ -14,13 +14,13 @@
 # limitations under the License.
 
 import base64
-import httplib
 import os.path
 import sys
 import unittest
-import urlparse
 
-from xml.etree import ElementTree
+from libcloud.py3 import httplib
+from libcloud.py3 import urlparse
+from libcloud.py3 import b
 
 import libcloud.utils
 
@@ -44,7 +44,7 @@ class AtmosTests(unittest.TestCase):
         AtmosMockHttp.type = None
         AtmosMockHttp.upload_created = False
         AtmosMockRawResponse.type = None
-        self.driver = AtmosDriver('dummy', base64.b64encode('dummy'))
+        self.driver = AtmosDriver('dummy', base64.b64encode(b('dummy')))
         self._remove_test_file()
 
     def tearDown(self):
@@ -342,7 +342,7 @@ class AtmosTests(unittest.TestCase):
 
     def test_signature_algorithm(self):
         test_uid = 'fredsmagicuid'
-        test_key = base64.b64encode('ssssshhhhhmysecretkey')
+        test_key = base64.b64encode(b('ssssshhhhhmysecretkey'))
         test_date = 'Mon, 04 Jul 2011 07:39:19 GMT'
         test_values = [
             ('GET', '/rest/namespace/foo', '', {},
@@ -372,7 +372,7 @@ class AtmosTests(unittest.TestCase):
             c.driver = d
             headers = c.add_default_headers(headers)
             headers['Date'] = headers['x-emc-date'] = test_date
-            self.assertEqual(c._calculate_signature({}, headers), expected)
+            self.assertEqual(c._calculate_signature({}, headers), b(expected))
 
 class AtmosMockHttp(StorageMockHttp, unittest.TestCase):
     fixtures = StorageFileFixtures('atmos')

Modified: libcloud/trunk/test/storage/test_base.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/storage/test_base.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/storage/test_base.py (original)
+++ libcloud/trunk/test/storage/test_base.py Sat Dec  3 21:38:59 2011
@@ -17,9 +17,15 @@ import sys
 import unittest
 import hashlib
 
-from StringIO import StringIO
 from mock import Mock
 
+from libcloud.py3 import StringIO
+from libcloud.py3 import PY3
+from libcloud.py3 import b
+
+if PY3:
+    from io import FileIO as file
+
 from libcloud.storage.base import StorageDriver
 
 from test import StorageMockHttp # pylint: disable-msg=E0611
@@ -73,7 +79,12 @@ class BaseStorageTests(unittest.TestCase
 
     def test_upload_zero_bytes_long_object_via_stream(self):
         iterator = Mock()
-        iterator.next.side_effect = StopIteration()
+
+        if PY3:
+            iterator.__next__ = Mock()
+            iterator.__next__.side_effect = StopIteration()
+        else:
+            iterator.next.side_effect = StopIteration()
 
         def mock_send(data):
             self.send_called += 1
@@ -88,7 +99,7 @@ class BaseStorageTests(unittest.TestCase
                                            chunked=False, calculate_hash=True)
 
         self.assertTrue(success)
-        self.assertEqual(data_hash, hashlib.md5('').hexdigest())
+        self.assertEqual(data_hash, hashlib.md5(b('')).hexdigest())
         self.assertEqual(bytes_transferred, 0)
         self.assertEqual(self.send_called, 1)
 
@@ -99,7 +110,7 @@ class BaseStorageTests(unittest.TestCase
                                            chunked=True, calculate_hash=True)
 
         self.assertTrue(success)
-        self.assertEqual(data_hash, hashlib.md5('').hexdigest())
+        self.assertEqual(data_hash, hashlib.md5(b('')).hexdigest())
         self.assertEqual(bytes_transferred, 0)
         self.assertEqual(self.send_called, 5)
 
@@ -116,7 +127,7 @@ class BaseStorageTests(unittest.TestCase
                                            calculate_hash=True)
 
         self.assertTrue(success)
-        self.assertEqual(data_hash, hashlib.md5(data).hexdigest())
+        self.assertEqual(data_hash, hashlib.md5(b(data)).hexdigest())
         self.assertEqual(bytes_transferred, (len(data)))
         self.assertEqual(self.send_called, 1)
 

Modified: libcloud/trunk/test/storage/test_cloudfiles.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/storage/test_cloudfiles.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/storage/test_cloudfiles.py (original)
+++ libcloud/trunk/test/storage/test_cloudfiles.py Sat Dec  3 21:38:59 2011
@@ -17,10 +17,15 @@ import os.path                          
 import sys
 import copy
 import unittest
-import httplib
 
 import libcloud.utils
 
+from libcloud.py3 import PY3
+from libcloud.py3 import httplib
+
+if PY3:
+    from io import FileIO as file
+
 from libcloud.common.types import LibcloudError, MalformedResponseError
 from libcloud.storage.base import Container, Object
 from libcloud.storage.types import ContainerAlreadyExistsError

Modified: libcloud/trunk/test/storage/test_google_storage.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/storage/test_google_storage.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/storage/test_google_storage.py (original)
+++ libcloud/trunk/test/storage/test_google_storage.py Sat Dec  3 21:38:59 2011
@@ -13,9 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-import os
 import sys
-import httplib
 import unittest
 
 from libcloud.storage.drivers.google_storage import GoogleStorageDriver

Modified: libcloud/trunk/test/storage/test_s3.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/storage/test_s3.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/storage/test_s3.py (original)
+++ libcloud/trunk/test/storage/test_s3.py Sat Dec  3 21:38:59 2011
@@ -15,9 +15,10 @@
 
 import os
 import sys
-import httplib
 import unittest
 
+from libcloud.py3 import httplib
+
 from libcloud.common.types import InvalidCredsError
 from libcloud.common.types import LibcloudError
 from libcloud.storage.base import Container, Object
@@ -276,7 +277,8 @@ class S3Tests(unittest.TestCase):
         self.mock_response_klass.type = 'UNAUTHORIZED'
         try:
             self.driver.list_containers()
-        except InvalidCredsError, e:
+        except InvalidCredsError:
+            e = sys.exc_info()[1]
             self.assertEqual(True, isinstance(e, InvalidCredsError))
         else:
             self.fail('Exception was not thrown')
@@ -514,7 +516,8 @@ class S3Tests(unittest.TestCase):
                                       object_name=object_name,
                                       verify_hash=True,
                                       ex_storage_class='invalid-class')
-        except ValueError, e:
+        except ValueError:
+            e = sys.exc_info()[1]
             self.assertTrue(str(e).lower().find('invalid storage class') != -1)
         else:
             self.fail('Exception was not thrown')

Modified: libcloud/trunk/test/test_response_classes.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/test_response_classes.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/test_response_classes.py (original)
+++ libcloud/trunk/test/test_response_classes.py Sat Dec  3 21:38:59 2011
@@ -15,10 +15,10 @@
 
 import sys
 import unittest
-import httplib
 
 from mock import Mock
 
+from libcloud.py3 import httplib
 from libcloud.common.base import XmlResponse, JsonResponse
 from libcloud.common.types import MalformedResponseError
 

Modified: libcloud/trunk/test/test_utils.py
URL: http://svn.apache.org/viewvc/libcloud/trunk/test/test_utils.py?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/test/test_utils.py (original)
+++ libcloud/trunk/test/test_utils.py Sat Dec  3 21:38:59 2011
@@ -18,17 +18,21 @@ import sys
 import unittest
 import warnings
 import os.path
-from StringIO import StringIO
 
 # In Python > 2.7 DeprecationWarnings are disabled by default
 warnings.simplefilter('default')
 
 import libcloud.utils
+from libcloud.py3 import StringIO
+from libcloud.py3 import PY3
 from libcloud.compute.types import Provider
 from libcloud.compute.providers import DRIVERS
 
 WARNINGS_BUFFER = []
 
+if PY3:
+    from io import FileIO as file
+
 
 def show_warning(msg, cat, fname, lno, line=None):
     WARNINGS_BUFFER.append((msg, cat, fname, lno))

Modified: libcloud/trunk/tox.ini
URL: http://svn.apache.org/viewvc/libcloud/trunk/tox.ini?rev=1210013&r1=1210012&r2=1210013&view=diff
==============================================================================
--- libcloud/trunk/tox.ini (original)
+++ libcloud/trunk/tox.ini Sat Dec  3 21:38:59 2011
@@ -1,5 +1,5 @@
 [tox]
-envlist = py25,py26,py27,pypy
+envlist = py25,py26,py27,pypy,py3
 
 [testenv]
 deps = mock
@@ -9,3 +9,6 @@ commands = python setup.py test
 deps = mock
        ssl
        simplejson
+
+[testenv:py3]
+deps = mock



Mime
View raw message