mirror of
https://github.com/saltstack/salt.git
synced 2025-04-17 10:10:20 +00:00
PyLint disable try-except-raise
This commit is contained in:
parent
5fe8d37a51
commit
f0bc3d7594
10 changed files with 21 additions and 48 deletions
|
@ -876,7 +876,7 @@ def _pytest(session, coverage, cmd_args):
|
|||
_run_with_coverage(session, 'coverage', 'run', '-m', 'py.test', *cmd_args)
|
||||
else:
|
||||
session.run('py.test', *cmd_args, env=env)
|
||||
except CommandFailed:
|
||||
except CommandFailed: # pylint: disable=try-except-raise
|
||||
# Not rerunning failed tests for now
|
||||
raise
|
||||
|
||||
|
|
|
@ -243,7 +243,7 @@ def _salt(fun, *args, **kw):
|
|||
if 'is not available.' in ret:
|
||||
raise SaltCloudSystemExit(
|
||||
'module/function {0} is not available'.format(fun))
|
||||
except SaltCloudSystemExit:
|
||||
except SaltCloudSystemExit: # pylint: disable=try-except-raise
|
||||
raise
|
||||
except TypeError:
|
||||
pass
|
||||
|
|
|
@ -121,7 +121,7 @@ class PlainTextSocketAppender(object):
|
|||
|
||||
try:
|
||||
time.sleep(wait_for)
|
||||
except KeyboardInterrupt:
|
||||
except KeyboardInterrupt: # pylint: disable=try-except-raise
|
||||
raise
|
||||
|
||||
def close_connection(self):
|
||||
|
|
|
@ -3067,7 +3067,7 @@ class SyndicManager(MinionBase):
|
|||
if auth_wait < self.max_auth_wait:
|
||||
auth_wait += self.auth_wait
|
||||
yield tornado.gen.sleep(auth_wait) # TODO: log?
|
||||
except (KeyboardInterrupt, SystemExit):
|
||||
except (KeyboardInterrupt, SystemExit): # pylint: disable=try-except-raise
|
||||
raise
|
||||
except Exception:
|
||||
failed = True
|
||||
|
|
|
@ -575,7 +575,7 @@ class AsyncTCPPubChannel(salt.transport.mixins.auth.AESPubClientMixin, salt.tran
|
|||
yield self.message_client.connect() # wait for the client to be connected
|
||||
self.connected = True
|
||||
# TODO: better exception handling...
|
||||
except KeyboardInterrupt:
|
||||
except KeyboardInterrupt: # pylint: disable=try-except-raise
|
||||
raise
|
||||
except Exception as exc:
|
||||
if '-|RETRY|-' not in six.text_type(exc):
|
||||
|
|
|
@ -64,10 +64,7 @@ class BrewModuleTest(ModuleCase):
|
|||
# Now remove the installed package
|
||||
self.run_function('pkg.remove', [DEL_PKG])
|
||||
del_list = self.run_function('pkg.list_pkgs')
|
||||
try:
|
||||
self.assertNotIn(DEL_PKG, del_list)
|
||||
except AssertionError:
|
||||
raise
|
||||
self.assertNotIn(DEL_PKG, del_list)
|
||||
except CommandExecutionError:
|
||||
self.run_function('pkg.remove', [DEL_PKG])
|
||||
raise
|
||||
|
|
|
@ -78,12 +78,9 @@ class MacGroupModuleTest(ModuleCase):
|
|||
self.run_function('group.delete', [DEL_GROUP])
|
||||
self.skipTest('Failed to create a group to delete')
|
||||
|
||||
try:
|
||||
# Now try to delete the added group
|
||||
ret = self.run_function('group.delete', [DEL_GROUP])
|
||||
self.assertTrue(ret)
|
||||
except CommandExecutionError:
|
||||
raise
|
||||
# Now try to delete the added group
|
||||
ret = self.run_function('group.delete', [DEL_GROUP])
|
||||
self.assertTrue(ret)
|
||||
|
||||
def test_mac_group_chgid(self):
|
||||
'''
|
||||
|
|
|
@ -85,10 +85,7 @@ class DarwinSysctlModuleTest(ModuleCase):
|
|||
self.run_function('sysctl.persist', [ASSIGN_CMD, 10])
|
||||
line = '{0}={1}'.format(ASSIGN_CMD, 10)
|
||||
found = self.__check_string(CONFIG, line)
|
||||
try:
|
||||
self.assertTrue(found)
|
||||
except AssertionError:
|
||||
raise
|
||||
self.assertTrue(found)
|
||||
except CommandExecutionError:
|
||||
os.remove(CONFIG)
|
||||
raise
|
||||
|
@ -103,10 +100,7 @@ class DarwinSysctlModuleTest(ModuleCase):
|
|||
try:
|
||||
self.run_function('sysctl.persist', [ASSIGN_CMD, 50])
|
||||
ret = self.run_function('sysctl.persist', [ASSIGN_CMD, 50])
|
||||
try:
|
||||
self.assertEqual(ret, 'Already set')
|
||||
except AssertionError:
|
||||
raise
|
||||
self.assertEqual(ret, 'Already set')
|
||||
except CommandExecutionError:
|
||||
os.remove(CONFIG)
|
||||
raise
|
||||
|
@ -126,10 +120,7 @@ class DarwinSysctlModuleTest(ModuleCase):
|
|||
[ASSIGN_CMD, rand],
|
||||
apply_change=True)
|
||||
info = int(self.run_function('sysctl.get', [ASSIGN_CMD]))
|
||||
try:
|
||||
self.assertEqual(info, rand)
|
||||
except AssertionError:
|
||||
raise
|
||||
self.assertEqual(info, rand)
|
||||
except CommandExecutionError:
|
||||
os.remove(CONFIG)
|
||||
raise
|
||||
|
|
|
@ -82,12 +82,9 @@ class MacUserModuleTest(ModuleCase):
|
|||
self.run_function('user.delete', [DEL_USER])
|
||||
self.skipTest('Failed to create a user to delete')
|
||||
|
||||
try:
|
||||
# Now try to delete the added user
|
||||
ret = self.run_function('user.delete', [DEL_USER])
|
||||
self.assertTrue(ret)
|
||||
except CommandExecutionError:
|
||||
raise
|
||||
# Now try to delete the added user
|
||||
ret = self.run_function('user.delete', [DEL_USER])
|
||||
self.assertTrue(ret)
|
||||
|
||||
def test_mac_user_primary_group(self):
|
||||
'''
|
||||
|
|
|
@ -5,23 +5,14 @@
|
|||
from __future__ import absolute_import, unicode_literals, print_function
|
||||
import os.path
|
||||
|
||||
try:
|
||||
import salt.modules.saltcheck as saltcheck
|
||||
import salt.config
|
||||
import salt.syspaths as syspaths
|
||||
except:
|
||||
raise
|
||||
import salt.config
|
||||
import salt.modules.saltcheck as saltcheck
|
||||
import salt.syspaths as syspaths
|
||||
|
||||
# Import Salt Testing Libs
|
||||
try:
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
from tests.support.unit import TestCase
|
||||
from tests.support.mock import (
|
||||
MagicMock,
|
||||
patch,
|
||||
)
|
||||
except:
|
||||
raise
|
||||
from tests.support.mixins import LoaderModuleMockMixin
|
||||
from tests.support.unit import TestCase
|
||||
from tests.support.mock import MagicMock, patch
|
||||
|
||||
|
||||
class LinuxSysctlTestCase(TestCase, LoaderModuleMockMixin):
|
||||
|
|
Loading…
Add table
Reference in a new issue