mirror of
https://github.com/valitydev/salt.git
synced 2024-11-06 16:45:27 +00:00
tests: standardize to modern 'except FooError as err:' syntax
This commit is contained in:
parent
e4b52f8bf2
commit
c487d86fff
@ -773,7 +773,7 @@ class ShellCase(TestCase):
|
||||
finally:
|
||||
try:
|
||||
process.terminate()
|
||||
except OSError, err:
|
||||
except OSError as err:
|
||||
# process already terminated
|
||||
pass
|
||||
|
||||
@ -785,7 +785,7 @@ class ShellCase(TestCase):
|
||||
finally:
|
||||
try:
|
||||
process.terminate()
|
||||
except OSError, err:
|
||||
except OSError as err:
|
||||
# process already terminated
|
||||
pass
|
||||
|
||||
|
@ -59,7 +59,7 @@ class PipStateTest(integration.ModuleCase, integration.SaltReturnAssertsMixIn):
|
||||
)
|
||||
try:
|
||||
os.makedirs(ographite)
|
||||
except OSError, err:
|
||||
except OSError as err:
|
||||
if err.errno == 13:
|
||||
# Permission denied
|
||||
self.skipTest(
|
||||
|
@ -39,7 +39,7 @@ class SSHKnownHostsStateTest(integration.ModuleCase,
|
||||
ret = self.run_state('ssh_known_hosts.present', **kwargs)
|
||||
try:
|
||||
self.assertSaltTrueReturn(ret)
|
||||
except AssertionError, err:
|
||||
except AssertionError as err:
|
||||
try:
|
||||
self.assertInSaltComment(
|
||||
ret, 'Unable to receive remote host key'
|
||||
|
@ -95,7 +95,7 @@ def run_integration_tests(opts):
|
||||
resource.RLIMIT_NOFILE,
|
||||
(REQUIRED_OPEN_FILES, hmax_open_files)
|
||||
)
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
print('ERROR: Failed to raise the max open files setting -> {0}'.format(err))
|
||||
print('Please issue the following command on your console:')
|
||||
print(' ulimit -n {0}'.format(REQUIRED_OPEN_FILES))
|
||||
|
@ -36,7 +36,7 @@ class TestLog(TestCase):
|
||||
# calculations.
|
||||
try:
|
||||
saltlog.SaltLoggingClass('{0}.with_digits'.format(__name__))
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
raise AssertionError(
|
||||
'No exception should have been raised: {0}'.format(err)
|
||||
)
|
||||
@ -55,7 +55,7 @@ class TestLog(TestCase):
|
||||
# calculations.
|
||||
try:
|
||||
saltlog.SaltLoggingClass('{0}.without_digits'.format(__name__))
|
||||
except Exception, err:
|
||||
except Exception as err:
|
||||
raise AssertionError(
|
||||
'No exception should have been raised: {0}'.format(err)
|
||||
)
|
||||
|
@ -176,7 +176,7 @@ class TestVerify(TestCase):
|
||||
handler.messages
|
||||
)
|
||||
handler.clear()
|
||||
except IOError, err:
|
||||
except IOError as err:
|
||||
if err.errno == 24:
|
||||
# Too many open files
|
||||
self.skipTest('We\'ve hit the max open files setting')
|
||||
|
Loading…
Reference in New Issue
Block a user