@@ -40,7 +40,7 @@ def test_from_path(self):
4040 # END for each type
4141
4242 # invalid path
43- self .failUnlessRaises (ValueError , TagReference , self .rorepo , "refs/invalid/tag" )
43+ self .assertRaises (ValueError , TagReference , self .rorepo , "refs/invalid/tag" )
4444 # works without path check
4545 TagReference (self .rorepo , "refs/invalid/tag" , check_path = False )
4646
@@ -54,7 +54,7 @@ def test_tag_base(self):
5454 tag_object_refs .append (tag )
5555 tagobj = tag .tag
5656 # have no dict
57- self .failUnlessRaises (AttributeError , setattr , tagobj , 'someattr' , 1 )
57+ self .assertRaises (AttributeError , setattr , tagobj , 'someattr' , 1 )
5858 assert isinstance (tagobj , TagObject )
5959 assert tagobj .tag == tag .name
6060 assert isinstance (tagobj .tagger , Actor )
@@ -63,7 +63,7 @@ def test_tag_base(self):
6363 assert tagobj .message
6464 assert tag .object == tagobj
6565 # can't assign the object
66- self .failUnlessRaises (AttributeError , setattr , tag , 'object' , tagobj )
66+ self .assertRaises (AttributeError , setattr , tag , 'object' , tagobj )
6767 # END if we have a tag object
6868 # END for tag in repo-tags
6969 assert tag_object_refs
@@ -201,7 +201,7 @@ def test_head_reset(self, rw_repo):
201201 cur_head .reset (new_head_commit , index = True ) # index only
202202 assert cur_head .reference .commit == new_head_commit
203203
204- self .failUnlessRaises (ValueError , cur_head .reset , new_head_commit , index = False , working_tree = True )
204+ self .assertRaises (ValueError , cur_head .reset , new_head_commit , index = False , working_tree = True )
205205 new_head_commit = new_head_commit .parents [0 ]
206206 cur_head .reset (new_head_commit , index = True , working_tree = True ) # index + wt
207207 assert cur_head .reference .commit == new_head_commit
@@ -211,7 +211,7 @@ def test_head_reset(self, rw_repo):
211211 cur_head .reset (cur_head , paths = "test" )
212212 cur_head .reset (new_head_commit , paths = "lib" )
213213 # hard resets with paths don't work, its all or nothing
214- self .failUnlessRaises (GitCommandError , cur_head .reset , new_head_commit , working_tree = True , paths = "lib" )
214+ self .assertRaises (GitCommandError , cur_head .reset , new_head_commit , working_tree = True , paths = "lib" )
215215
216216 # we can do a mixed reset, and then checkout from the index though
217217 cur_head .reset (new_head_commit )
@@ -235,7 +235,7 @@ def test_head_reset(self, rw_repo):
235235 cur_head .reference = curhead_commit
236236 assert cur_head .commit == curhead_commit
237237 assert cur_head .is_detached
238- self .failUnlessRaises (TypeError , getattr , cur_head , "reference" )
238+ self .assertRaises (TypeError , getattr , cur_head , "reference" )
239239
240240 # tags are references, hence we can point to them
241241 some_tag = rw_repo .tags [0 ]
@@ -248,7 +248,7 @@ def test_head_reset(self, rw_repo):
248248 cur_head .reference = active_head
249249
250250 # type check
251- self .failUnlessRaises (ValueError , setattr , cur_head , "reference" , "that" )
251+ self .assertRaises (ValueError , setattr , cur_head , "reference" , "that" )
252252
253253 # head handling
254254 commit = 'HEAD'
@@ -263,7 +263,7 @@ def test_head_reset(self, rw_repo):
263263 Head .create (rw_repo , new_name , new_head .commit )
264264
265265 # its not fine with a different value
266- self .failUnlessRaises (OSError , Head .create , rw_repo , new_name , new_head .commit .parents [0 ])
266+ self .assertRaises (OSError , Head .create , rw_repo , new_name , new_head .commit .parents [0 ])
267267
268268 # force it
269269 new_head = Head .create (rw_repo , new_name , actual_commit , force = True )
@@ -276,7 +276,7 @@ def test_head_reset(self, rw_repo):
276276
277277 # rename with force
278278 tmp_head = Head .create (rw_repo , "tmphead" )
279- self .failUnlessRaises (GitCommandError , tmp_head .rename , new_head )
279+ self .assertRaises (GitCommandError , tmp_head .rename , new_head )
280280 tmp_head .rename (new_head , force = True )
281281 assert tmp_head == new_head and tmp_head .object == new_head .object
282282
@@ -289,12 +289,12 @@ def test_head_reset(self, rw_repo):
289289 assert tmp_head not in heads and new_head not in heads
290290 # force on deletion testing would be missing here, code looks okay though ;)
291291 # END for each new head name
292- self .failUnlessRaises (TypeError , RemoteReference .create , rw_repo , "some_name" )
292+ self .assertRaises (TypeError , RemoteReference .create , rw_repo , "some_name" )
293293
294294 # tag ref
295295 tag_name = "5.0.2"
296296 TagReference .create (rw_repo , tag_name )
297- self .failUnlessRaises (GitCommandError , TagReference .create , rw_repo , tag_name )
297+ self .assertRaises (GitCommandError , TagReference .create , rw_repo , tag_name )
298298 light_tag = TagReference .create (rw_repo , tag_name , "HEAD~1" , force = True )
299299 assert isinstance (light_tag , TagReference )
300300 assert light_tag .name == tag_name
@@ -354,13 +354,13 @@ def test_head_reset(self, rw_repo):
354354
355355 # setting a non-commit as commit fails, but succeeds as object
356356 head_tree = head .commit .tree
357- self .failUnlessRaises (ValueError , setattr , head , 'commit' , head_tree )
357+ self .assertRaises (ValueError , setattr , head , 'commit' , head_tree )
358358 assert head .commit == old_commit # and the ref did not change
359359 # we allow heds to point to any object
360360 head .object = head_tree
361361 assert head .object == head_tree
362362 # cannot query tree as commit
363- self .failUnlessRaises (TypeError , getattr , head , 'commit' )
363+ self .assertRaises (TypeError , getattr , head , 'commit' )
364364
365365 # set the commit directly using the head. This would never detach the head
366366 assert not cur_head .is_detached
@@ -397,7 +397,7 @@ def test_head_reset(self, rw_repo):
397397
398398 # create a new branch that is likely to touch the file we changed
399399 far_away_head = rw_repo .create_head ("far_head" , 'HEAD~100' )
400- self .failUnlessRaises (GitCommandError , far_away_head .checkout )
400+ self .assertRaises (GitCommandError , far_away_head .checkout )
401401 assert active_branch == active_branch .checkout (force = True )
402402 assert rw_repo .head .reference != far_away_head
403403
@@ -408,7 +408,7 @@ def test_head_reset(self, rw_repo):
408408 assert ref .path == full_ref
409409 assert ref .object == rw_repo .head .commit
410410
411- self .failUnlessRaises (OSError , Reference .create , rw_repo , full_ref , 'HEAD~20' )
411+ self .assertRaises (OSError , Reference .create , rw_repo , full_ref , 'HEAD~20' )
412412 # it works if it is at the same spot though and points to the same reference
413413 assert Reference .create (rw_repo , full_ref , 'HEAD' ).path == full_ref
414414 Reference .delete (rw_repo , full_ref )
@@ -434,11 +434,11 @@ def test_head_reset(self, rw_repo):
434434 # END for each name type
435435
436436 # References that don't exist trigger an error if we want to access them
437- self .failUnlessRaises (ValueError , getattr , Reference (rw_repo , "refs/doesntexist" ), 'commit' )
437+ self .assertRaises (ValueError , getattr , Reference (rw_repo , "refs/doesntexist" ), 'commit' )
438438
439439 # exists, fail unless we force
440440 ex_ref_path = far_away_head .path
441- self .failUnlessRaises (OSError , ref .rename , ex_ref_path )
441+ self .assertRaises (OSError , ref .rename , ex_ref_path )
442442 # if it points to the same commit it works
443443 far_away_head .commit = ref .commit
444444 ref .rename (ex_ref_path )
@@ -451,7 +451,7 @@ def test_head_reset(self, rw_repo):
451451 assert symref .path == symref_path
452452 assert symref .reference == cur_head .reference
453453
454- self .failUnlessRaises (OSError , SymbolicReference .create , rw_repo , symref_path , cur_head .reference .commit )
454+ self .assertRaises (OSError , SymbolicReference .create , rw_repo , symref_path , cur_head .reference .commit )
455455 # it works if the new ref points to the same reference
456456 SymbolicReference .create (rw_repo , symref .path , symref .reference ).path == symref .path # @NoEffect
457457 SymbolicReference .delete (rw_repo , symref )
@@ -541,7 +541,7 @@ def test_head_reset(self, rw_repo):
541541 # if the assignment raises, the ref doesn't exist
542542 Reference .delete (ref .repo , ref .path )
543543 assert not ref .is_valid ()
544- self .failUnlessRaises (ValueError , setattr , ref , 'commit' , "nonsense" )
544+ self .assertRaises (ValueError , setattr , ref , 'commit' , "nonsense" )
545545 assert not ref .is_valid ()
546546
547547 # I am sure I had my reason to make it a class method at first, but
@@ -555,7 +555,7 @@ def test_head_reset(self, rw_repo):
555555
556556 Reference .delete (ref .repo , ref .path )
557557 assert not ref .is_valid ()
558- self .failUnlessRaises (ValueError , setattr , ref , 'object' , "nonsense" )
558+ self .assertRaises (ValueError , setattr , ref , 'object' , "nonsense" )
559559 assert not ref .is_valid ()
560560
561561 # END for each path
0 commit comments