mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-06-01 05:49:09 -07:00
[cloud][tests] fixtures for placebo to test AWS modules using boto3 (#21253)
* [cloud][tests] Create fixtures for using placebo to test boto3-using modules * Use pytest's importorskip instead of manually skipping on missing deps * Fix imports in cloudformation module * Delete unused code * Add maybe_sleep fixtures to speed up recorded test runs * Build basic placebo-CFN tests * Commit placebo recordings of basic stack operations * Add placebo to test-requires * Allow unit tests to run regardless of environment by setting a default region * Use explicit relative import for Python 3 compat * Use __name__ attribute that works on Python 2 and 3
This commit is contained in:
parent
5591d639f5
commit
2196fa0e95
36 changed files with 1724 additions and 15 deletions
|
@ -237,6 +237,8 @@ except ImportError:
|
|||
|
||||
# import a class, otherwise we'll use a fully qualified path
|
||||
from ansible.module_utils.ec2 import AWSRetry
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
import ansible.module_utils.ec2
|
||||
|
||||
def boto_exception(err):
|
||||
'''generic error message handler'''
|
||||
|
@ -250,17 +252,6 @@ def boto_exception(err):
|
|||
return error
|
||||
|
||||
|
||||
def boto_version_required(version_tuple):
|
||||
parts = boto3.__version__.split('.')
|
||||
boto_version = []
|
||||
try:
|
||||
for part in parts:
|
||||
boto_version.append(int(part))
|
||||
except ValueError:
|
||||
boto_version.append(-1)
|
||||
return tuple(boto_version) >= tuple(version_tuple)
|
||||
|
||||
|
||||
def get_stack_events(cfn, stack_name):
|
||||
'''This event data was never correct, it worked as a side effect. So the v2.3 format is different.'''
|
||||
ret = {'events':[], 'log':[]}
|
||||
|
@ -507,10 +498,6 @@ def main():
|
|||
'directly to the CloudFormation API.')]
|
||||
module.exit_json(**result)
|
||||
|
||||
# import module snippets
|
||||
from ansible.module_utils.basic import AnsibleModule
|
||||
import ansible.module_utils.ec2
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue