@@ -40,7 +40,7 @@ def test_from_path(self):
40
40
# END for each type
41
41
42
42
# invalid path
43
- self .failUnlessRaises (ValueError , TagReference , self .rorepo , "refs/invalid/tag" )
43
+ self .assertRaises (ValueError , TagReference , self .rorepo , "refs/invalid/tag" )
44
44
# works without path check
45
45
TagReference (self .rorepo , "refs/invalid/tag" , check_path = False )
46
46
@@ -54,7 +54,7 @@ def test_tag_base(self):
54
54
tag_object_refs .append (tag )
55
55
tagobj = tag .tag
56
56
# have no dict
57
- self .failUnlessRaises (AttributeError , setattr , tagobj , 'someattr' , 1 )
57
+ self .assertRaises (AttributeError , setattr , tagobj , 'someattr' , 1 )
58
58
assert isinstance (tagobj , TagObject )
59
59
assert tagobj .tag == tag .name
60
60
assert isinstance (tagobj .tagger , Actor )
@@ -63,7 +63,7 @@ def test_tag_base(self):
63
63
assert tagobj .message
64
64
assert tag .object == tagobj
65
65
# can't assign the object
66
- self .failUnlessRaises (AttributeError , setattr , tag , 'object' , tagobj )
66
+ self .assertRaises (AttributeError , setattr , tag , 'object' , tagobj )
67
67
# END if we have a tag object
68
68
# END for tag in repo-tags
69
69
assert tag_object_refs
@@ -201,7 +201,7 @@ def test_head_reset(self, rw_repo):
201
201
cur_head .reset (new_head_commit , index = True ) # index only
202
202
assert cur_head .reference .commit == new_head_commit
203
203
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 )
205
205
new_head_commit = new_head_commit .parents [0 ]
206
206
cur_head .reset (new_head_commit , index = True , working_tree = True ) # index + wt
207
207
assert cur_head .reference .commit == new_head_commit
@@ -211,7 +211,7 @@ def test_head_reset(self, rw_repo):
211
211
cur_head .reset (cur_head , paths = "test" )
212
212
cur_head .reset (new_head_commit , paths = "lib" )
213
213
# 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" )
215
215
216
216
# we can do a mixed reset, and then checkout from the index though
217
217
cur_head .reset (new_head_commit )
@@ -235,7 +235,7 @@ def test_head_reset(self, rw_repo):
235
235
cur_head .reference = curhead_commit
236
236
assert cur_head .commit == curhead_commit
237
237
assert cur_head .is_detached
238
- self .failUnlessRaises (TypeError , getattr , cur_head , "reference" )
238
+ self .assertRaises (TypeError , getattr , cur_head , "reference" )
239
239
240
240
# tags are references, hence we can point to them
241
241
some_tag = rw_repo .tags [0 ]
@@ -248,7 +248,7 @@ def test_head_reset(self, rw_repo):
248
248
cur_head .reference = active_head
249
249
250
250
# type check
251
- self .failUnlessRaises (ValueError , setattr , cur_head , "reference" , "that" )
251
+ self .assertRaises (ValueError , setattr , cur_head , "reference" , "that" )
252
252
253
253
# head handling
254
254
commit = 'HEAD'
@@ -263,7 +263,7 @@ def test_head_reset(self, rw_repo):
263
263
Head .create (rw_repo , new_name , new_head .commit )
264
264
265
265
# 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 ])
267
267
268
268
# force it
269
269
new_head = Head .create (rw_repo , new_name , actual_commit , force = True )
@@ -276,7 +276,7 @@ def test_head_reset(self, rw_repo):
276
276
277
277
# rename with force
278
278
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 )
280
280
tmp_head .rename (new_head , force = True )
281
281
assert tmp_head == new_head and tmp_head .object == new_head .object
282
282
@@ -289,12 +289,12 @@ def test_head_reset(self, rw_repo):
289
289
assert tmp_head not in heads and new_head not in heads
290
290
# force on deletion testing would be missing here, code looks okay though ;)
291
291
# 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" )
293
293
294
294
# tag ref
295
295
tag_name = "5.0.2"
296
296
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 )
298
298
light_tag = TagReference .create (rw_repo , tag_name , "HEAD~1" , force = True )
299
299
assert isinstance (light_tag , TagReference )
300
300
assert light_tag .name == tag_name
@@ -354,13 +354,13 @@ def test_head_reset(self, rw_repo):
354
354
355
355
# setting a non-commit as commit fails, but succeeds as object
356
356
head_tree = head .commit .tree
357
- self .failUnlessRaises (ValueError , setattr , head , 'commit' , head_tree )
357
+ self .assertRaises (ValueError , setattr , head , 'commit' , head_tree )
358
358
assert head .commit == old_commit # and the ref did not change
359
359
# we allow heds to point to any object
360
360
head .object = head_tree
361
361
assert head .object == head_tree
362
362
# cannot query tree as commit
363
- self .failUnlessRaises (TypeError , getattr , head , 'commit' )
363
+ self .assertRaises (TypeError , getattr , head , 'commit' )
364
364
365
365
# set the commit directly using the head. This would never detach the head
366
366
assert not cur_head .is_detached
@@ -397,7 +397,7 @@ def test_head_reset(self, rw_repo):
397
397
398
398
# create a new branch that is likely to touch the file we changed
399
399
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 )
401
401
assert active_branch == active_branch .checkout (force = True )
402
402
assert rw_repo .head .reference != far_away_head
403
403
@@ -408,7 +408,7 @@ def test_head_reset(self, rw_repo):
408
408
assert ref .path == full_ref
409
409
assert ref .object == rw_repo .head .commit
410
410
411
- self .failUnlessRaises (OSError , Reference .create , rw_repo , full_ref , 'HEAD~20' )
411
+ self .assertRaises (OSError , Reference .create , rw_repo , full_ref , 'HEAD~20' )
412
412
# it works if it is at the same spot though and points to the same reference
413
413
assert Reference .create (rw_repo , full_ref , 'HEAD' ).path == full_ref
414
414
Reference .delete (rw_repo , full_ref )
@@ -434,11 +434,11 @@ def test_head_reset(self, rw_repo):
434
434
# END for each name type
435
435
436
436
# 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' )
438
438
439
439
# exists, fail unless we force
440
440
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 )
442
442
# if it points to the same commit it works
443
443
far_away_head .commit = ref .commit
444
444
ref .rename (ex_ref_path )
@@ -451,7 +451,7 @@ def test_head_reset(self, rw_repo):
451
451
assert symref .path == symref_path
452
452
assert symref .reference == cur_head .reference
453
453
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 )
455
455
# it works if the new ref points to the same reference
456
456
SymbolicReference .create (rw_repo , symref .path , symref .reference ).path == symref .path # @NoEffect
457
457
SymbolicReference .delete (rw_repo , symref )
@@ -541,7 +541,7 @@ def test_head_reset(self, rw_repo):
541
541
# if the assignment raises, the ref doesn't exist
542
542
Reference .delete (ref .repo , ref .path )
543
543
assert not ref .is_valid ()
544
- self .failUnlessRaises (ValueError , setattr , ref , 'commit' , "nonsense" )
544
+ self .assertRaises (ValueError , setattr , ref , 'commit' , "nonsense" )
545
545
assert not ref .is_valid ()
546
546
547
547
# 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):
555
555
556
556
Reference .delete (ref .repo , ref .path )
557
557
assert not ref .is_valid ()
558
- self .failUnlessRaises (ValueError , setattr , ref , 'object' , "nonsense" )
558
+ self .assertRaises (ValueError , setattr , ref , 'object' , "nonsense" )
559
559
assert not ref .is_valid ()
560
560
561
561
# END for each path
0 commit comments