Remove nose from unittests (#54055)
* 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 anymorepull/4420/head
parent
dbb782a594
commit
f5f4948480
|
@ -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:
|
To work with documentation on your local machine, you need the following packages installed:
|
||||||
|
|
||||||
.. code-block:: none
|
- libyaml
|
||||||
|
- PyYAML
|
||||||
- libyaml
|
- six
|
||||||
- PyYAML
|
- tornado
|
||||||
- nose
|
- pyparsing
|
||||||
- six
|
- gcc
|
||||||
- tornado
|
- jinja2
|
||||||
- pyparsing
|
- rstcheck
|
||||||
- gcc
|
- sphinx
|
||||||
- jinja2
|
|
||||||
- rstcheck
|
|
||||||
- sphinx
|
|
||||||
|
|
||||||
.. note::
|
.. note::
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ cryptography
|
||||||
pycrypto
|
pycrypto
|
||||||
jinja2
|
jinja2
|
||||||
mock
|
mock
|
||||||
nose
|
|
||||||
passlib
|
passlib
|
||||||
pytest
|
pytest
|
||||||
pytest-mock
|
pytest-mock
|
||||||
|
|
|
@ -6,10 +6,10 @@
|
||||||
# To execute this by hand:
|
# To execute this by hand:
|
||||||
# 1) cd <checkoutdir>
|
# 1) cd <checkoutdir>
|
||||||
# 2) source hacking/env-setup
|
# 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
|
import re
|
||||||
from ansible.compat.tests import unittest
|
import unittest
|
||||||
|
|
||||||
# TYPE_REGEX = re.compile(r'.*\stype\(.*')
|
# TYPE_REGEX = re.compile(r'.*\stype\(.*')
|
||||||
# TYPE_REGEX = re.compile(r'.*(if|or)\stype\(.*')
|
# TYPE_REGEX = re.compile(r'.*(if|or)\stype\(.*')
|
||||||
|
|
|
@ -10,9 +10,12 @@ import os
|
||||||
import json
|
import json
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from nose.plugins.skip import SkipTest
|
import pytest
|
||||||
|
|
||||||
|
pytestmark = []
|
||||||
|
|
||||||
if sys.version_info < (2, 7):
|
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 import unittest
|
||||||
from units.compat.mock import Mock
|
from units.compat.mock import Mock
|
||||||
|
@ -60,7 +63,10 @@ except ImportError:
|
||||||
from f5.utils.responses.handlers import Stats
|
from f5.utils.responses.handlers import Stats
|
||||||
from units.modules.utils import set_module_args
|
from units.modules.utils import set_module_args
|
||||||
except ImportError:
|
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_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||||
fixture_data = {}
|
fixture_data = {}
|
||||||
|
|
|
@ -11,9 +11,10 @@ import json
|
||||||
import pytest
|
import pytest
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from nose.plugins.skip import SkipTest
|
pytestmark = []
|
||||||
|
|
||||||
if sys.version_info < (2, 7):
|
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 import unittest
|
||||||
from units.compat.mock import Mock
|
from units.compat.mock import Mock
|
||||||
|
@ -38,7 +39,8 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||||
from units.modules.utils import set_module_args
|
from units.modules.utils import set_module_args
|
||||||
except ImportError:
|
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_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||||
fixture_data = {}
|
fixture_data = {}
|
||||||
|
|
|
@ -11,9 +11,10 @@ import json
|
||||||
import pytest
|
import pytest
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
from nose.plugins.skip import SkipTest
|
pytestmark = []
|
||||||
|
|
||||||
if sys.version_info < (2, 7):
|
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 import unittest
|
||||||
from units.compat.mock import Mock
|
from units.compat.mock import Mock
|
||||||
|
@ -38,7 +39,8 @@ except ImportError:
|
||||||
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
from ansible.module_utils.network.f5.common import iControlUnexpectedHTTPError
|
||||||
from units.modules.utils import set_module_args
|
from units.modules.utils import set_module_args
|
||||||
except ImportError:
|
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_path = os.path.join(os.path.dirname(__file__), 'fixtures')
|
||||||
fixture_data = {}
|
fixture_data = {}
|
||||||
|
|
Loading…
Reference in New Issue