diff --git a/test/units/contrib/inventory/test_vmware_inventory.py b/test/units/contrib/inventory/test_vmware_inventory.py index c2c851237fc..5c5a8511126 100644 --- a/test/units/contrib/inventory/test_vmware_inventory.py +++ b/test/units/contrib/inventory/test_vmware_inventory.py @@ -6,13 +6,20 @@ import pickle import unittest import sys +try: + from vmware_inventory import VMWareInventory +except ImportError: + from nose.plugins.skip import SkipTest + raise SkipTest("test_vmware_inventory.py requires the python module 'vmware_inventory'") + + # contrib's dirstruct doesn't contain __init__.py files checkout_path = os.path.dirname(__file__) checkout_path = checkout_path.replace('/test/units/contrib/inventory', '') inventory_dir = os.path.join(checkout_path, 'contrib', 'inventory') sys.path.append(os.path.abspath(inventory_dir)) -from vmware_inventory import VMWareInventory + # cleanup so that nose's path is not polluted with other inv scripts sys.path.remove(os.path.abspath(inventory_dir))