Use arg_spec type for comparisons on default and choices (#37741)

* Use arg_spec type for comparisons on default and choices

* Further improve type casting

* Make sure to capture output in more places

* Individually report invalid choices

* Update ignore.txt after resolving merge conflicts
This commit is contained in:
Matt Martz 2018-03-26 12:15:32 -05:00 committed by GitHub
parent 9890ce47e8
commit ffbbb5a25b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 330 additions and 206 deletions

View file

@ -45,22 +45,14 @@ def add_mocks(filename):
pre_sys_modules = list(sys.modules.keys())
module_mock = mock.MagicMock()
mocks = []
for module_class in MODULE_CLASSES:
mocks.append(
mock.patch('%s.__init__' % module_class, new=module_mock)
)
for m in mocks:
p = m.start()
p = mock.patch('%s.__init__' % module_class, new=module_mock).start()
p.side_effect = AnsibleModuleCallError('AnsibleModuleCallError')
mocks.append(
mock.patch('ansible.module_utils.basic._load_params').start()
)
mock.patch('ansible.module_utils.basic._load_params').start()
yield module_mock
for m in mocks:
m.stop()
mock.patch.stopall()
# Clean up imports to prevent issues with mutable data being used in modules
for k in list(sys.modules.keys()):