summaryrefslogtreecommitdiff
path: root/src/etcd
diff options
context:
space:
mode:
authorGiuseppe Lavagetto <lavagetto@gmail.com>2013-11-24 12:31:05 +0100
committerGiuseppe Lavagetto <lavagetto@gmail.com>2013-12-02 19:34:26 +0100
commit16abbe885e7dee641072bfeea70e488f6834e430 (patch)
tree753847a7ad8a3078cb26e995137180fcee59d9cc /src/etcd
parentcb3401e19c4f780e57934cacce45e5f9de332f94 (diff)
Python3 compatibility initial commit (after 2to3 run)
Diffstat (limited to 'src/etcd')
-rw-r--r--src/etcd/__init__.py2
-rw-r--r--src/etcd/client.py6
-rw-r--r--src/etcd/tests/__init__.py2
-rw-r--r--src/etcd/tests/integration/test_simple.py22
-rw-r--r--src/etcd/tests/unit/__init__.py4
5 files changed, 18 insertions, 18 deletions
diff --git a/src/etcd/__init__.py b/src/etcd/__init__.py
index 69de598..943feb3 100644
--- a/src/etcd/__init__.py
+++ b/src/etcd/__init__.py
@@ -1,5 +1,5 @@
import collections
-from client import Client
+from .client import Client
class EtcdResult(collections.namedtuple(
'EtcdResult',
diff --git a/src/etcd/client.py b/src/etcd/client.py
index aea173d..a31af8c 100644
--- a/src/etcd/client.py
+++ b/src/etcd/client.py
@@ -234,7 +234,7 @@ class Client(object):
if ttl:
params['ttl'] = ttl
- for (k,v) in kwdargs.iteritems():
+ for (k,v) in kwdargs.items():
if k in self._comparison_conditions:
if type(v) == bool:
params[k] = v and "true" or "false"
@@ -273,7 +273,7 @@ class Client(object):
"""
params = {}
- for (k,v) in kwdargs.iteritems():
+ for (k,v) in kwdargs.items():
if k in self._read_options:
if type(v) == bool:
params[k] = v and "true" or "false"
@@ -421,7 +421,7 @@ class Client(object):
if response.status == 201:
res['newKey'] = True
return etcd.EtcdResult(**res)
- except Exception, e:
+ except Exception as e:
raise etcd.EtcdException('Unable to decode server response: %s' % e)
def _next_server(self):
diff --git a/src/etcd/tests/__init__.py b/src/etcd/tests/__init__.py
index 69a51c2..9814b86 100644
--- a/src/etcd/tests/__init__.py
+++ b/src/etcd/tests/__init__.py
@@ -1 +1 @@
-import unit
+from . import unit
diff --git a/src/etcd/tests/integration/test_simple.py b/src/etcd/tests/integration/test_simple.py
index 8006033..dd3bbde 100644
--- a/src/etcd/tests/integration/test_simple.py
+++ b/src/etcd/tests/integration/test_simple.py
@@ -9,7 +9,7 @@ import tempfile
import urllib3
import etcd
-import helpers
+from . import helpers
from nose.tools import nottest
@@ -74,7 +74,7 @@ class TestSimple(EtcdIntegrationTest):
try:
get_result = self.client.get('/test_set')
assert False
- except KeyError, e:
+ except KeyError as e:
pass
self.assertFalse('/test_set' in self.client)
@@ -101,7 +101,7 @@ class TestSimple(EtcdIntegrationTest):
try:
get_result = self.client.get('/test_set')
assert False
- except KeyError, e:
+ except KeyError as e:
pass
def test_retrieve_subkeys(self):
@@ -124,7 +124,7 @@ class TestErrors(EtcdIntegrationTest):
try:
get_result = self.client.set('/directory', 'test-value')
assert False
- except KeyError, e:
+ except KeyError as e:
pass
def test_test_and_set(self):
@@ -144,7 +144,7 @@ class TestErrors(EtcdIntegrationTest):
'old-test-value')
assert False
- except ValueError, e:
+ except ValueError as e:
pass
@@ -454,14 +454,14 @@ class TestAuthenticatedAccess(EtcdIntegrationTest):
set_result = client.set('/test_set', 'test-key')
self.fail()
- except etcd.EtcdException, e:
+ except etcd.EtcdException as e:
self.assertTrue(e.message.startswith("Unable to decode server response"))
try:
get_result = client.get('/test_set')
self.fail()
- except etcd.EtcdException, e:
+ except etcd.EtcdException as e:
self.assertTrue(e.message.startswith("Unable to decode server response"))
def test_get_set_unauthenticated_missing_ca(self):
@@ -480,12 +480,12 @@ class TestAuthenticatedAccess(EtcdIntegrationTest):
try:
set_result = client.set('/test_set', 'test-key')
assert False
- except urllib3.exceptions.SSLError, e:
+ except urllib3.exceptions.SSLError as e:
assert True
try:
get_result = client.get('/test_set')
- except urllib3.exceptions.SSLError, e:
+ except urllib3.exceptions.SSLError as e:
assert True
def test_get_set_authenticated(self):
@@ -554,14 +554,14 @@ class TestClientAuthenticatedAccess(EtcdIntegrationTest):
set_result = client.set('/test_set', 'test-key')
self.fail()
- except etcd.EtcdException, e:
+ except etcd.EtcdException as e:
self.assertTrue(e.message.startswith("Unable to decode server response"))
try:
get_result = client.get('/test_set')
self.fail()
- except etcd.EtcdException, e:
+ except etcd.EtcdException as e:
self.assertTrue(e.message.startswith("Unable to decode server response"))
def test_get_set_authenticated(self):
diff --git a/src/etcd/tests/unit/__init__.py b/src/etcd/tests/unit/__init__.py
index 1e35a7f..8cd6aa2 100644
--- a/src/etcd/tests/unit/__init__.py
+++ b/src/etcd/tests/unit/__init__.py
@@ -1,2 +1,2 @@
-import test_client
-import test_request
+from . import test_client
+from . import test_request