From 912e6ea30ffc8c67033c7815d7adee0cc9db5f90 Mon Sep 17 00:00:00 2001 From: Martin Cech Date: Thu, 21 Apr 2016 13:02:09 -0400 Subject: [PATCH] port TS test fix so we can rely on jenkins --- test/tool_shed/base/twilltestcase.py | 24 ++++++++++-------------- 1 file changed, 10 insertions(+), 14 deletions(-) diff --git a/test/tool_shed/base/twilltestcase.py b/test/tool_shed/base/twilltestcase.py index 310a24915e1..b4ecb4f7a74 100644 --- a/test/tool_shed/base/twilltestcase.py +++ b/test/tool_shed/base/twilltestcase.py @@ -10,7 +10,6 @@ import urllib 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 @@ -256,20 +255,17 @@ class ShedTwillTestCase( TwillTestCase ): 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 + # 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 - 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' ] )