From 83703e3137d97888eaf611dfb4f9c7e304bdbdd0 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Thu, 15 Jun 2017 10:24:08 -0400 Subject: [PATCH] skip f5 tests when f5 lib not installed --- test/units/modules/network/f5/test_bigip_snmp.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/test/units/modules/network/f5/test_bigip_snmp.py b/test/units/modules/network/f5/test_bigip_snmp.py index 243a47a765..deab015132 100644 --- a/test/units/modules/network/f5/test_bigip_snmp.py +++ b/test/units/modules/network/f5/test_bigip_snmp.py @@ -22,8 +22,9 @@ __metaclass__ = type import sys +from nose.plugins.skip import SkipTest + if sys.version_info < (2, 7): - from nose.plugins.skip import SkipTest raise SkipTest("F5 Ansible modules require Python >= 2.7") import os @@ -40,9 +41,12 @@ try: from library.bigip_snmp import ModuleManager from library.bigip_snmp import ArgumentSpec except ImportError: - from ansible.modules.network.f5.bigip_snmp import Parameters - from ansible.modules.network.f5.bigip_snmp import ModuleManager - from ansible.modules.network.f5.bigip_snmp import ArgumentSpec + try: + from ansible.modules.network.f5.bigip_snmp import Parameters + from ansible.modules.network.f5.bigip_snmp import ModuleManager + from ansible.modules.network.f5.bigip_snmp import ArgumentSpec + except ImportError: + raise SkipTest("F5 Ansible modules the f5 python library") fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {}