1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Port some tests away from nose as examples (#33437)

We don't need to use both nose and pytest.  Once we get rid of all uses
of nose we can remove the extra dependency
This commit is contained in:
Toshio Kuratomi 2017-11-30 14:04:09 -08:00 committed by GitHub
parent c35a562345
commit e499bccbaa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 19 additions and 23 deletions

View file

@ -22,8 +22,6 @@ __metaclass__ = type
import json
from nose.tools import eq_, raises
from ansible.compat.tests import unittest
from ansible.module_utils.json_utils import _filter_non_json_lines

View file

@ -20,14 +20,15 @@
from __future__ import (absolute_import, division, print_function)
from nose.plugins.skip import SkipTest
import pytest
import sys
import pytest
from ansible.module_utils.ec2 import HAS_BOTO3
from units.modules.utils import set_module_args
if not HAS_BOTO3:
raise SkipTest("test_api_gateway.py requires the `boto3` and `botocore` modules")
pytestmark = pytest.mark.skip("test_api_gateway.py requires the `boto3` and `botocore` modules")
import ansible.modules.cloud.amazon.aws_api_gateway as agw

View file

@ -15,20 +15,18 @@
# You should have received a copy of the GNU General Public License
# along with Ansible. If not, see <http://www.gnu.org/licenses/>.
import pytest
import os
import json
import collections
import pytest
from . placebo_fixtures import placeboify, maybe_sleep
from nose.plugins.skip import SkipTest
from ansible.modules.cloud.amazon import data_pipeline
from ansible.module_utils._text import to_text
try:
import boto3
except ImportError:
raise SkipTest("test_api_gateway.py requires the `boto3` and `botocore` modules")
# test_api_gateway.py requires the `boto3` and `botocore` modules
boto3 = pytest.importorskip('boto3')
@pytest.fixture(scope='module')

View file

@ -5,16 +5,17 @@
from __future__ import (absolute_import, division, print_function)
from nose.plugins.skip import SkipTest
import json
import pytest
from copy import deepcopy
import pytest
from ansible.module_utils._text import to_bytes
from ansible.module_utils import basic
from ansible.module_utils.ec2 import HAS_BOTO3
if not HAS_BOTO3:
raise SkipTest("test_elb_application_lb.py requires the `boto3` and `botocore` modules")
pytestmark = pytest.mark.skip("test_elb_application_lb.py requires the `boto3` and `botocore` modules")
import ansible.modules.cloud.amazon.elb_application_lb as elb_module

View file

@ -21,13 +21,14 @@ from __future__ import (absolute_import, division, print_function)
import copy
from nose.plugins.skip import SkipTest
import pytest
from ansible.module_utils.aws.core import HAS_BOTO3
from ansible.compat.tests.mock import MagicMock
from units.modules.utils import set_module_args
if not HAS_BOTO3:
raise SkipTest("test_api_gateway.py requires the `boto3` and `botocore` modules")
pytestmark = pytest.mark.skip("test_api_gateway.py requires the `boto3` and `botocore` modules")
# these are here cause ... boto!
from botocore.exceptions import ClientError

View file

@ -5,8 +5,7 @@ import unittest
try:
import ansible.modules.cloud.amazon.s3 as s3
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("This test requires the s3 Python libraries")
pytestmark = pytest.mark.skip("This test requires the s3 Python libraries")
from ansible.module_utils.six.moves.urllib.parse import urlparse

View file

@ -17,14 +17,12 @@
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import pytest
from ansible.compat.tests import unittest
from ansible.plugins.filter.ipaddr import (ipaddr, _netmask_query, nthhost, next_nth_usable,
previous_nth_usable, network_in_usable, network_in_network)
try:
import netaddr
except ImportError:
from nose.plugins.skip import SkipTest
raise SkipTest("This test requires the `netaddr` python library")
netaddr = pytest.importorskip('netaddr')
class TestIpFilter(unittest.TestCase):