mirror of
https://github.com/ansible-collections/community.general.git
synced 2026-05-06 21:32:49 +00:00
Ensure that current uses of BaseException are required
* In some cases, it appears that Exception should have been used instead as there's no need to catch sys.exit KeyboardInterrupt and similar. * In a few cases, it appears that BaseException is used because a library we depend on calls sys.exit() contrary to good coding design. Comment those so that we know that those have been audited and found to be correct and change to use (Exception, SystemExit) instead.
This commit is contained in:
@@ -99,6 +99,8 @@ def test_python_module(path, base_dir, messages, ansible_module):
|
||||
except ImporterAnsibleModuleException:
|
||||
# module instantiated AnsibleModule without raising an exception
|
||||
pass
|
||||
# We truly want to catch anything the plugin might do here, including call sys.exit() so we
|
||||
# catch BaseException
|
||||
except BaseException as ex: # pylint: disable=locally-disabled, broad-except
|
||||
capture_report(path, capture, messages)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ sys.modules['cvprac.cvp_client_errors'] = Mock()
|
||||
from ansible.modules.network.cloudvision import cv_server_provision
|
||||
|
||||
|
||||
class MockException(BaseException):
|
||||
class MockException(Exception):
|
||||
pass
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user