@@ -74,7 +74,7 @@ def test_get_set_delete(self):
74
74
try :
75
75
get_result = self .client .get ('/test_set' )
76
76
assert False
77
- except KeyError as e :
77
+ except etcd . EtcdKeyNotFound as e :
78
78
pass
79
79
80
80
self .assertFalse ('/test_set' in self .client )
@@ -100,7 +100,7 @@ def test_get_set_delete(self):
100
100
try :
101
101
get_result = self .client .get ('/test_set' )
102
102
assert False
103
- except KeyError as e :
103
+ except etcd . EtcdKeyNotFound as e :
104
104
pass
105
105
106
106
def test_update (self ):
@@ -120,7 +120,7 @@ def test_retrieve_subkeys(self):
120
120
set_result = self .client .write ('/subtree/test_set2' , 'test-key3' )
121
121
get_result = self .client .read ('/subtree' , recursive = True )
122
122
result = [subkey .value for subkey in get_result .leaves ]
123
- self .assertEquals (['test-key1' , 'test-key2' , 'test-key3' ], result )
123
+ self .assertEquals (['test-key1' , 'test-key2' , 'test-key3' ]. sort () , result . sort () )
124
124
125
125
def test_directory_ttl_update (self ):
126
126
""" INTEGRATION: should be able to update a dir TTL """
@@ -140,7 +140,7 @@ def test_is_not_a_file(self):
140
140
""" INTEGRATION: try to write value to an existing directory """
141
141
142
142
self .client .set ('/directory/test-key' , 'test-value' )
143
- self .assertRaises (KeyError , self .client .set , '/directory' , 'test-value' )
143
+ self .assertRaises (etcd . EtcdNotFile , self .client .set , '/directory' , 'test-value' )
144
144
145
145
def test_test_and_set (self ):
146
146
""" INTEGRATION: try test_and_set operation """
@@ -159,7 +159,8 @@ def test_creating_already_existing_directory(self):
159
159
`prevExist=True` should fail """
160
160
self .client .write ('/mydir' , None , dir = True )
161
161
162
- self .assertRaises (KeyError , self .client .write , '/mydir' , None , dir = True )
162
+ self .assertRaises (etcd .EtcdNotFile , self .client .write , '/mydir' , None , dir = True )
163
+ self .assertRaises (etcd .EtcdAlreadyExist , self .client .write , '/mydir' , None , dir = True , prevExist = False )
163
164
164
165
165
166
class TestClusterFunctions (EtcdIntegrationTest ):
0 commit comments