diff --git a/test/units/module_utils/ec2/test_aws.py b/test/units/module_utils/ec2/test_aws.py index fdc1b36676..d7e7ffbed0 100644 --- a/test/units/module_utils/ec2/test_aws.py +++ b/test/units/module_utils/ec2/test_aws.py @@ -23,13 +23,13 @@ try: except: HAS_BOTO3 = False -from nose.plugins.skip import SkipTest +import pytest from units.compat 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'") + pytestmark = pytest.mark.skip("test_aws.py requires the python modules 'boto3' and 'botocore'") class RetryTestCase(unittest.TestCase): diff --git a/test/units/module_utils/network/aci/test_aci.py b/test/units/module_utils/network/aci/test_aci.py index f4379ff896..64bccbadbf 100644 --- a/test/units/module_utils/network/aci/test_aci.py +++ b/test/units/module_utils/network/aci/test_aci.py @@ -25,7 +25,7 @@ from ansible.module_utils.network.aci.aci import ACIModule from ansible.module_utils.six import PY2, PY3 from ansible.module_utils._text import to_native -from nose.plugins.skip import SkipTest +import pytest class AltModule(): @@ -52,7 +52,7 @@ try: if sys.version_info >= (2, 7): from xmljson import cobra except ImportError: - raise SkipTest("ACI Ansible modules require the lxml and xmljson Python libraries") + pytestmark = pytest.mark.skip("ACI Ansible modules require the lxml and xmljson Python libraries") class AciRest(unittest.TestCase): diff --git a/test/units/modules/network/fortimanager/test_fmgr_provisioning.py b/test/units/modules/network/fortimanager/test_fmgr_provisioning.py index b774bb223c..8755c56a5b 100644 --- a/test/units/modules/network/fortimanager/test_fmgr_provisioning.py +++ b/test/units/modules/network/fortimanager/test_fmgr_provisioning.py @@ -19,19 +19,20 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from nose.plugins.skip import SkipTest +import pytest +pytestmark = [] try: from ansible.modules.network.fortimanager import fmgr_provisioning from .fortimanager_module import TestFortimanagerModule from units.modules.utils import set_module_args except ImportError: - raise SkipTest("Could not load required modules for testing") + pytestmark.append(pytest.mark.skip("Could not load required modules for testing")) try: from pyFMG.fortimgr import FortiManager except ImportError: - raise SkipTest("FortiManager tests require pyFMG package") + pytestmark.append(pytest.mark.skip("FortiManager tests require pyFMG package")) class TestFmgrProvisioningModule(TestFortimanagerModule): diff --git a/test/units/modules/network/fortimanager/test_fmgr_script.py b/test/units/modules/network/fortimanager/test_fmgr_script.py index 2c5d729dd1..d0a9c7467c 100644 --- a/test/units/modules/network/fortimanager/test_fmgr_script.py +++ b/test/units/modules/network/fortimanager/test_fmgr_script.py @@ -19,19 +19,20 @@ from __future__ import (absolute_import, division, print_function) __metaclass__ = type -from nose.plugins.skip import SkipTest +import pytest +pytestmark = [] try: from ansible.modules.network.fortimanager import fmgr_script from .fortimanager_module import TestFortimanagerModule from units.modules.utils import set_module_args except ImportError: - raise SkipTest("Could not load required modules for testing") + pytestmark.append(pytest.mark.skip("Could not load required modules for testing")) try: from pyFMG.fortimgr import FortiManager except ImportError: - raise SkipTest("FortiManager tests require pyFMG package") + pytestmark.append(pytest.mark.skip("FortiManager tests require pyFMG package")) class TestFmgrScriptModule(TestFortimanagerModule): diff --git a/test/units/modules/network/nuage/nuage_module.py b/test/units/modules/network/nuage/nuage_module.py index cae2a50500..417c9cdd0f 100644 --- a/test/units/modules/network/nuage/nuage_module.py +++ b/test/units/modules/network/nuage/nuage_module.py @@ -19,12 +19,13 @@ from units.compat.mock import patch from units.modules.utils import set_module_args as _set_module_args, AnsibleExitJson, AnsibleFailJson, ModuleTestCase -from nose.plugins.skip import SkipTest +import pytest + try: from vspk import v5_0 as vsdk from bambou import nurest_session except ImportError: - raise SkipTest('Nuage Ansible modules requires the vspk and bambou python libraries') + pytestmark = pytest.mark.skip('Nuage Ansible modules requires the vspk and bambou python libraries') def set_module_args(args): diff --git a/test/units/modules/network/nuage/test_nuage_vspk.py b/test/units/modules/network/nuage/test_nuage_vspk.py index 27c3618f34..adebd78461 100644 --- a/test/units/modules/network/nuage/test_nuage_vspk.py +++ b/test/units/modules/network/nuage/test_nuage_vspk.py @@ -18,16 +18,19 @@ import sys -from nose.plugins.skip import SkipTest +import pytest + +pytestmark = [] + if not(sys.version_info[0] == 2 and sys.version_info[1] >= 7): - raise SkipTest('Nuage Ansible modules requires Python 2.7') + pytestmark.append(pytest.mark.skip('Nuage Ansible modules requires Python 2.7')) try: from vspk import v5_0 as vsdk from bambou.exceptions import BambouHTTPError from ansible.modules.network.nuage import nuage_vspk except ImportError: - raise SkipTest('Nuage Ansible modules requires the vspk and bambou python libraries') + pytestmark.append(pytest.mark.skip('Nuage Ansible modules requires the vspk and bambou python libraries')) from units.compat.mock import patch from units.modules.utils import set_module_args, AnsibleExitJson, AnsibleFailJson