Python 3: use "as" instead of comma in except clause

This commit is contained in:
Nicola Soranzo
2016-05-17 23:53:16 +01:00
parent ed4132d9c0
commit 8a43b2b492
73 changed files with 152 additions and 152 deletions
+4 -4
View File
@@ -54,7 +54,7 @@ if minor < 6:
# if nose is installed do a skip test
from nose.plugins.skip import SkipTest
raise SkipTest( msg )
except ImportError, i_err:
except ImportError as i_err:
raise AssertionError( msg )
# --------------------------------------------------------------------
@@ -145,7 +145,7 @@ class CasperJSTestCase( unittest.TestCase ):
# couldn't find the headless browser,
# provide information (as it won't be included by default with galaxy)
except OSError, os_err:
except OSError as os_err:
if os_err.errno == errno.ENOENT:
log.error( 'No path to headless browser executable: %s\n' +
'These tests were designed to use the following headless browser:\n%s',
@@ -208,7 +208,7 @@ class CasperJSTestCase( unittest.TestCase ):
self.browser_backtrace_to_string( last_error['backtrace'] ) ) )
# if we couldn't parse json from what's returned on the error, dump stdout
except ValueError, val_err:
except ValueError as val_err:
if str( val_err ) == 'No JSON object could be decoded':
log.debug( '(error parsing returned JSON from casperjs, dumping stdout...)\n:%s', stdout_output )
return HeadlessJSJavascriptError( 'see log for details' )
@@ -216,7 +216,7 @@ class CasperJSTestCase( unittest.TestCase ):
raise
# otherwise, raise a vanilla exc
except Exception, exc:
except Exception as exc:
log.debug( '(failed to parse error returned from %s: %s)', _PATH_TO_HEADLESS, str( exc ) )
return HeadlessJSJavascriptError(
"ERROR in headless browser script %s" % ( script_path ) )
+3 -3
View File
@@ -104,7 +104,7 @@ class TestEnvironment( object ):
text = f.read()
f.close()
shed_tools_dict = loads( text )
except Exception, exc:
except Exception as exc:
log.error( 'Error reading tool shed test file "%s": %s', self.tool_shed_test_file, exc, exc_info=True )
return shed_tools_dict
@@ -116,7 +116,7 @@ class TestEnvironment( object ):
try:
if not os.path.exists( self.saved_output_dir ):
os.makedirs( self.saved_output_dir )
except Exception, exc:
except Exception as exc:
log.error( 'unable to create saved files directory "%s": %s',
self.saved_output_dir, exc, exc_info=True )
self.saved_output_dir = None
@@ -128,7 +128,7 @@ class TestEnvironment( object ):
if self.debug_these_tests:
try:
debug_list = self.debug_these_tests.split( delim )
except Exception, exc:
except Exception as exc:
log.error( 'unable to parse debug_these_tests "%s": %s',
self.debug_these_tests, exc, exc_info=True )
self.debug_these_tests = debug_list