From 745f72916fb32eda96a42b930e311265bc69e313 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 7 Jun 2017 17:24:51 -0400 Subject: [PATCH] bigip tests now skipped if missing lib --- .../modules/network/f5/test_bigip_command.py | 11 ++++++++--- .../modules/network/f5/test_bigip_config.py | 10 +++++++--- .../modules/network/f5/test_bigip_gtm_pool.py | 15 ++++++++++----- .../units/modules/network/f5/test_bigip_pool.py | 11 ++++++++--- .../modules/network/f5/test_bigip_snmp_trap.py | 17 +++++++++++------ .../units/modules/network/f5/test_bigip_user.py | 15 ++++++++++----- 6 files changed, 54 insertions(+), 25 deletions(-) diff --git a/test/units/modules/network/f5/test_bigip_command.py b/test/units/modules/network/f5/test_bigip_command.py index 4d3254ede02..d7d3eb52f85 100644 --- a/test/units/modules/network/f5/test_bigip_command.py +++ b/test/units/modules/network/f5/test_bigip_command.py @@ -40,9 +40,14 @@ try: from library.bigip_command import ModuleManager from library.bigip_command import ArgumentSpec except ImportError: - from ansible.modules.network.f5.bigip_command import Parameters - from ansible.modules.network.f5.bigip_command import ModuleManager - from ansible.modules.network.f5.bigip_command import ArgumentSpec + try: + from ansible.modules.network.f5.bigip_command import Parameters + from ansible.modules.network.f5.bigip_command import ModuleManager + from ansible.modules.network.f5.bigip_command import ArgumentSpec + except ImportError: + from nose.plugins.skip import SkipTest + raise SkipTest("%s requires the python modules for f5/bigip" % __file__) + fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') diff --git a/test/units/modules/network/f5/test_bigip_config.py b/test/units/modules/network/f5/test_bigip_config.py index dc1aefe2f73..e56f0c2b33d 100644 --- a/test/units/modules/network/f5/test_bigip_config.py +++ b/test/units/modules/network/f5/test_bigip_config.py @@ -40,9 +40,13 @@ try: from library.bigip_config import ModuleManager from library.bigip_config import ArgumentSpec except ImportError: - from ansible.modules.network.f5.bigip_config import Parameters - from ansible.modules.network.f5.bigip_config import ModuleManager - from ansible.modules.network.f5.bigip_config import ArgumentSpec + try: + from ansible.modules.network.f5.bigip_config import Parameters + from ansible.modules.network.f5.bigip_config import ModuleManager + from ansible.modules.network.f5.bigip_config import ArgumentSpec + except ImportError: + from nose.plugins.skip import SkipTest + raise SkipTest("%s requires the python modules for f5/bigip" % __file__) fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') diff --git a/test/units/modules/network/f5/test_bigip_gtm_pool.py b/test/units/modules/network/f5/test_bigip_gtm_pool.py index 5b8b9aed701..287594b9238 100644 --- a/test/units/modules/network/f5/test_bigip_gtm_pool.py +++ b/test/units/modules/network/f5/test_bigip_gtm_pool.py @@ -42,11 +42,16 @@ try: from library.bigip_gtm_pool import UntypedManager from library.bigip_gtm_pool import TypedManager except ImportError: - from ansible.modules.network.f5.bigip_gtm_pool import Parameters - from ansible.modules.network.f5.bigip_gtm_pool import ModuleManager - from ansible.modules.network.f5.bigip_gtm_pool import ArgumentSpec - from ansible.modules.network.f5.bigip_gtm_pool import UntypedManager - from ansible.modules.network.f5.bigip_gtm_pool import TypedManager + try: + from ansible.modules.network.f5.bigip_gtm_pool import Parameters + from ansible.modules.network.f5.bigip_gtm_pool import ModuleManager + from ansible.modules.network.f5.bigip_gtm_pool import ArgumentSpec + from ansible.modules.network.f5.bigip_gtm_pool import UntypedManager + from ansible.modules.network.f5.bigip_gtm_pool import TypedManager + except ImportError: + from nose.plugins.skip import SkipTest + raise SkipTest("%s requires the python modules for f5/bigip" % __file__) + fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_pool.py b/test/units/modules/network/f5/test_bigip_pool.py index b704d29c07d..1bdb847fad6 100644 --- a/test/units/modules/network/f5/test_bigip_pool.py +++ b/test/units/modules/network/f5/test_bigip_pool.py @@ -42,9 +42,14 @@ try: from library.bigip_pool import ModuleManager from library.bigip_pool import ArgumentSpec except ImportError: - from ansible.modules.network.f5.bigip_pool import Parameters - from ansible.modules.network.f5.bigip_pool import ModuleManager - from ansible.modules.network.f5.bigip_pool import ArgumentSpec + try: + from ansible.modules.network.f5.bigip_pool import Parameters + from ansible.modules.network.f5.bigip_pool import ModuleManager + from ansible.modules.network.f5.bigip_pool import ArgumentSpec + except ImportError: + from nose.plugins.skip import SkipTest + raise SkipTest("%s requires the python modules for f5/bigip" % __file__) + fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_snmp_trap.py b/test/units/modules/network/f5/test_bigip_snmp_trap.py index ee377ef35c9..3cec735da3f 100644 --- a/test/units/modules/network/f5/test_bigip_snmp_trap.py +++ b/test/units/modules/network/f5/test_bigip_snmp_trap.py @@ -43,12 +43,17 @@ try: from library.bigip_snmp_trap import NonNetworkedManager from library.bigip_snmp_trap import ArgumentSpec except ImportError: - from ansible.modules.network.f5.bigip_snmp_trap import NetworkedParameters - from ansible.modules.network.f5.bigip_snmp_trap import NonNetworkedParameters - from ansible.modules.network.f5.bigip_snmp_trap import ModuleManager - from ansible.modules.network.f5.bigip_snmp_trap import NetworkedManager - from ansible.modules.network.f5.bigip_snmp_trap import NonNetworkedManager - from ansible.modules.network.f5.bigip_snmp_trap import ArgumentSpec + try: + from ansible.modules.network.f5.bigip_snmp_trap import NetworkedParameters + from ansible.modules.network.f5.bigip_snmp_trap import NonNetworkedParameters + from ansible.modules.network.f5.bigip_snmp_trap import ModuleManager + from ansible.modules.network.f5.bigip_snmp_trap import NetworkedManager + from ansible.modules.network.f5.bigip_snmp_trap import NonNetworkedManager + from ansible.modules.network.f5.bigip_snmp_trap import ArgumentSpec + except ImportError: + from nose.plugins.skip import SkipTest + raise SkipTest("%s requires the python modules for f5/bigip" % __file__) + fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {} diff --git a/test/units/modules/network/f5/test_bigip_user.py b/test/units/modules/network/f5/test_bigip_user.py index f2367f826b3..4d9edbf35ab 100644 --- a/test/units/modules/network/f5/test_bigip_user.py +++ b/test/units/modules/network/f5/test_bigip_user.py @@ -45,11 +45,16 @@ try: from library.bigip_user import UnparitionedManager from library.bigip_user import PartitionedManager except ImportError: - from ansible.modules.network.f5.bigip_user import Parameters - from ansible.modules.network.f5.bigip_user import ModuleManager - from ansible.modules.network.f5.bigip_user import ArgumentSpec - from ansible.modules.network.f5.bigip_user import UnparitionedManager - from ansible.modules.network.f5.bigip_user import PartitionedManager + try: + from ansible.modules.network.f5.bigip_user import Parameters + from ansible.modules.network.f5.bigip_user import ModuleManager + from ansible.modules.network.f5.bigip_user import ArgumentSpec + from ansible.modules.network.f5.bigip_user import UnparitionedManager + from ansible.modules.network.f5.bigip_user import PartitionedManager + except ImportError: + from nose.plugins.skip import SkipTest + raise SkipTest("%s requires the python modules for f5/bigip" % __file__) + fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') fixture_data = {}