@@ -330,10 +330,8 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
330
330
331
331
# rejected - undo last commit
332
332
lhead .reset ("HEAD~1" )
333
- res = remote .push (lhead .reference )
334
- self .assertTrue (res [0 ].flags & PushInfo .ERROR )
335
- self .assertTrue (res [0 ].flags & PushInfo .REJECTED )
336
- self ._do_test_push_result (res , remote )
333
+ with self .assertRaises (GitCommandError ):
334
+ remote .push (lhead .reference )
337
335
338
336
# force rejected pull
339
337
res = remote .push ('+%s' % lhead .reference )
@@ -356,11 +354,9 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
356
354
357
355
# update push new tags
358
356
# Rejection is default
359
- new_tag = TagReference .create (rw_repo , to_be_updated , reference = 'HEAD~1' , force = True )
360
- res = remote .push (tags = True )
361
- self ._do_test_push_result (res , remote )
362
- self .assertTrue (res [- 1 ].flags & PushInfo .REJECTED )
363
- self .assertTrue (res [- 1 ].flags & PushInfo .ERROR )
357
+ new_tag = TagReference .create (rw_repo , to_be_updated , ref = 'HEAD~1' , force = True )
358
+ with self .assertRaises (GitCommandError ):
359
+ remote .push (tags = True )
364
360
365
361
# push force this tag
366
362
res = remote .push ("+%s" % new_tag .path )
@@ -386,11 +382,8 @@ def _assert_push_and_pull(self, remote, rw_repo, remote_repo):
386
382
387
383
# rejected stale delete
388
384
force_with_lease = "%s:0000000000000000000000000000000000000000" % new_head .path
389
- res = remote .push (":%s" % new_head .path , force_with_lease = force_with_lease )
390
- self .assertTrue (res [0 ].flags & PushInfo .ERROR )
391
- self .assertTrue (res [0 ].flags & PushInfo .REJECTED )
392
- self .assertIsNone (res [0 ].local_ref )
393
- self ._do_test_push_result (res , remote )
385
+ with self .assertRaises (GitCommandError ):
386
+ remote .push (":%s" % new_head .path , force_with_lease = force_with_lease )
394
387
395
388
# delete new branch on the remote end and locally
396
389
res = remote .push (":%s" % new_head .path )
0 commit comments