Skip to content

Commit

Permalink
Merge pull request #2130 from martenson/try-fix-pushcheck
Browse files Browse the repository at this point in the history
try pushing again when we get unexpected exception...
  • Loading branch information
nsoranzo committed Apr 13, 2016
2 parents 408827e + 26a4c13 commit 4797f81
Showing 1 changed file with 10 additions and 14 deletions.
24 changes: 10 additions & 14 deletions test/shed_functional/base/twilltestcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@

import twill.commands as tc
from mercurial import commands, hg, ui
from mercurial.util import Abort

import galaxy.model.tool_shed_install as galaxy_model
import galaxy.util
Expand Down Expand Up @@ -259,20 +258,17 @@ def clone_repository( self, repository, destination_path ):
def commit_and_push( self, repository, hgrepo, options, username, password ):
url = 'http://%s:%s@%s:%s/repos/%s/%s' % ( username, password, self.host, self.port, repository.user.username, repository.name )
commands.commit( ui.ui(), hgrepo, **options )
try:
commands.push( ui.ui(), hgrepo, dest=url )
except Abort as a:
message = a
if 'authorization failed' in message:
return False
else:
raise
except Exception as e:
if str(e).find('Pushing to Tool Shed is disabled') != -1:
return False
# Try pushing multiple times as it transiently fails on Jenkins.
# TODO: Figure out why that happens
for i in range(2):
try:
commands.push( ui.ui(), hgrepo, dest=url )
except Exception as e:
if str(e).find('Pushing to Tool Shed is disabled') != -1:
return False
else:
raise
return True
return True
raise

def create_category( self, **kwd ):
category = test_db_util.get_category_by_name( kwd[ 'name' ] )
Expand Down

0 comments on commit 4797f81

Please sign in to comment.