@@ -74,7 +74,7 @@ def test_get_set_delete(self):
7474 try :
7575 get_result = self .client .get ('/test_set' )
7676 assert False
77- except KeyError as e :
77+ except etcd . EtcdKeyNotFound as e :
7878 pass
7979
8080 self .assertFalse ('/test_set' in self .client )
@@ -100,7 +100,7 @@ def test_get_set_delete(self):
100100 try :
101101 get_result = self .client .get ('/test_set' )
102102 assert False
103- except KeyError as e :
103+ except etcd . EtcdKeyNotFound as e :
104104 pass
105105
106106 def test_update (self ):
@@ -120,7 +120,7 @@ def test_retrieve_subkeys(self):
120120 set_result = self .client .write ('/subtree/test_set2' , 'test-key3' )
121121 get_result = self .client .read ('/subtree' , recursive = True )
122122 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 () )
124124
125125 def test_directory_ttl_update (self ):
126126 """ INTEGRATION: should be able to update a dir TTL """
@@ -140,7 +140,7 @@ def test_is_not_a_file(self):
140140 """ INTEGRATION: try to write value to an existing directory """
141141
142142 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' )
144144
145145 def test_test_and_set (self ):
146146 """ INTEGRATION: try test_and_set operation """
@@ -159,7 +159,8 @@ def test_creating_already_existing_directory(self):
159159 `prevExist=True` should fail """
160160 self .client .write ('/mydir' , None , dir = True )
161161
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 )
163164
164165
165166class TestClusterFunctions (EtcdIntegrationTest ):
0 commit comments