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