Skip to content

Commit

Permalink
Remove nose from unittests (ansible#54055)
Browse files Browse the repository at this point in the history
* Remove nose from unittests

This PR migrates the last of our unittests from using nose to using
pytest.  We don't need to install nose in our testing environments
anymore
  • Loading branch information
abadger authored Mar 20, 2019
1 parent dbb782a commit f5f4948
Show file tree
Hide file tree
Showing 6 changed files with 30 additions and 24 deletions.
21 changes: 9 additions & 12 deletions docs/docsite/rst/community/documentation_contributions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -62,18 +62,15 @@ If you make multiple changes to the documentation, or add more than a line to it

To work with documentation on your local machine, you need the following packages installed:

.. code-block:: none
- libyaml
- PyYAML
- nose
- six
- tornado
- pyparsing
- gcc
- jinja2
- rstcheck
- sphinx
- libyaml
- PyYAML
- six
- tornado
- pyparsing
- gcc
- jinja2
- rstcheck
- sphinx

.. note::

Expand Down
1 change: 0 additions & 1 deletion test/runner/requirements/units.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ cryptography
pycrypto
jinja2
mock
nose
passlib
pytest
pytest-mock
Expand Down
4 changes: 2 additions & 2 deletions test/sanity/validate-modules/test_validate_modules_regex.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
# To execute this by hand:
# 1) cd <checkoutdir>
# 2) source hacking/env-setup
# 3) PYTHONPATH=./lib nosetests -d -w test -v --nocapture sanity/validate-modules
# 3) PYTHONPATH=./lib pytest -v sanity/validate-modules

import re
from ansible.compat.tests import unittest
import unittest

# TYPE_REGEX = re.compile(r'.*\stype\(.*')
# TYPE_REGEX = re.compile(r'.*(if|or)\stype\(.*')
Expand Down
12 changes: 9 additions & 3 deletions test/units/modules/network/f5/test_bigip_gtm_facts.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,12 @@
import json
import sys

from nose.plugins.skip import SkipTest
import pytest

pytestmark = []

if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
pytestmark.append(pytest.mark.skip("F5 Ansible modules require Python >= 2.7"))

from units.compat import unittest
from units.compat.mock import Mock
Expand Down Expand Up @@ -60,7 +63,10 @@
from f5.utils.responses.handlers import Stats
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
pytestmark.append(pytest.mark.skip("F5 Ansible modules require the f5-sdk Python library"))
# pytestmark will cause this test to skip but we have to define A so that classes can be
# defined below
A = object

fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import pytest
import sys

from nose.plugins.skip import SkipTest
pytestmark = []

if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
pytestmark.append(pytest.mark.skip("F5 Ansible modules require Python >= 2.7"))

from units.compat import unittest
from units.compat.mock import Mock
Expand All @@ -38,7 +39,8 @@
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
pytestmark.append(pytest.mark.skip("F5 Ansible modules require the f5-sdk Python library"))


fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,10 @@
import pytest
import sys

from nose.plugins.skip import SkipTest
pytestmark = []

if sys.version_info < (2, 7):
raise SkipTest("F5 Ansible modules require Python >= 2.7")
pytestmark.append(pytest.mark.skip("F5 Ansible modules require Python >= 2.7"))

from units.compat import unittest
from units.compat.mock import Mock
Expand All @@ -38,7 +39,8 @@
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
from units.modules.utils import set_module_args
except ImportError:
raise SkipTest("F5 Ansible modules require the f5-sdk Python library")
pytestmark.append(pytest.mark.skip("F5 Ansible modules require the f5-sdk Python library"))


fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures')
fixture_data = {}
Expand Down

0 comments on commit f5f4948

Please sign in to comment.