From 8bf4aa97b0bec0f1f7e665a1c18eabe3b4ab9dff Mon Sep 17 00:00:00 2001 From: Adrian Likins Date: Thu, 13 Oct 2016 16:19:40 -0400 Subject: [PATCH] Skip test_aws.py if boto3/botocore are missing (#17814) --- test/units/module_utils/ec2/test_aws.py | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/test/units/module_utils/ec2/test_aws.py b/test/units/module_utils/ec2/test_aws.py index afb86b66c44..ba27c6cec4d 100644 --- a/test/units/module_utils/ec2/test_aws.py +++ b/test/units/module_utils/ec2/test_aws.py @@ -16,12 +16,22 @@ # You should have received a copy of the GNU General Public License # along with Ansible. If not, see . -import unittest -import botocore -import boto3 +try: + import boto3 + import botocore + HAS_BOTO3 = True +except: + HAS_BOTO3 = False +from nose.plugins.skip import SkipTest + +from ansible.compat.tests import unittest from ansible.module_utils.ec2 import AWSRetry +if not HAS_BOTO3: + raise SkipTest("test_aws.py requires the python modules 'boto3' and 'botocore'") + + class RetryTestCase(unittest.TestCase): def test_no_failures(self):