diff --git a/.zuul.yaml b/.zuul.yaml index fd20909e..0eed1965 100644 --- a/.zuul.yaml +++ b/.zuul.yaml @@ -1,4 +1,4 @@ - project: templates: - - openstack-python3-charm-jobs + - openstack-python3-ussuri-jobs - openstack-cover-jobs diff --git a/test-requirements.txt b/test-requirements.txt index f853625d..7ce4d17c 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -13,11 +13,7 @@ setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb requests>=2.18.4 -# Newer mock seems to have some syntax which is newer than python3.5 (e.g. -# f'{something}' -mock>=1.2,<4.0.0; python_version < '3.6' -mock>=1.2; python_version >= '3.6' - +flake8>=2.2.4,<=2.4.1 stestr>=2.2.0 # Dependency of stestr. Workaround for diff --git a/unit_tests/test_actions_add_disk.py b/unit_tests/test_actions_add_disk.py index 0fdef53a..e29b99ef 100644 --- a/unit_tests/test_actions_add_disk.py +++ b/unit_tests/test_actions_add_disk.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from actions import add_disk diff --git a/unit_tests/test_actions_blacklist.py b/unit_tests/test_actions_blacklist.py index a74e96fd..9484ccd5 100644 --- a/unit_tests/test_actions_blacklist.py +++ b/unit_tests/test_actions_blacklist.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from charmhelpers.core import hookenv diff --git a/unit_tests/test_actions_osd_out_in.py b/unit_tests/test_actions_osd_out_in.py index 9c0a3790..5808adfe 100644 --- a/unit_tests/test_actions_osd_out_in.py +++ b/unit_tests/test_actions_osd_out_in.py @@ -11,11 +11,12 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import mock -import subprocess +import subprocess import sys +from unittest import mock + from test_utils import CharmTestCase sys.path.append('hooks') diff --git a/unit_tests/test_actions_service.py b/unit_tests/test_actions_service.py index 57deafd3..5c3af854 100644 --- a/unit_tests/test_actions_service.py +++ b/unit_tests/test_actions_service.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +import unittest.mock as mock from contextlib import contextmanager from actions import service diff --git a/unit_tests/test_actions_zap_disk.py b/unit_tests/test_actions_zap_disk.py index 375b026f..00ce17f3 100644 --- a/unit_tests/test_actions_zap_disk.py +++ b/unit_tests/test_actions_zap_disk.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from actions import zap_disk diff --git a/unit_tests/test_ceph_hooks.py b/unit_tests/test_ceph_hooks.py index 7f8132cb..5d13f86c 100644 --- a/unit_tests/test_ceph_hooks.py +++ b/unit_tests/test_ceph_hooks.py @@ -17,7 +17,7 @@ from collections import OrderedDict import copy import unittest -from mock import patch, MagicMock, call +from unittest.mock import patch, MagicMock, call import charmhelpers.contrib.storage.linux.ceph as ceph diff --git a/unit_tests/test_ceph_utils.py b/unit_tests/test_ceph_utils.py index 1172f1a7..722558b2 100644 --- a/unit_tests/test_ceph_utils.py +++ b/unit_tests/test_ceph_utils.py @@ -15,7 +15,7 @@ import unittest -from mock import patch +from unittest.mock import patch with patch('charmhelpers.contrib.hardening.harden.harden') as mock_dec: mock_dec.side_effect = (lambda *dargs, **dkwargs: lambda f: diff --git a/unit_tests/test_config.py b/unit_tests/test_config.py index fe5c1094..574a3021 100644 --- a/unit_tests/test_config.py +++ b/unit_tests/test_config.py @@ -18,7 +18,7 @@ import tempfile import sys import test_utils -from mock import patch, MagicMock +from unittest.mock import patch, MagicMock # python-apt is not installed as part of test-requirements but is imported by # some charmhelpers modules so create a fake import. diff --git a/unit_tests/test_status.py b/unit_tests/test_status.py index d296eb17..433f92e6 100644 --- a/unit_tests/test_status.py +++ b/unit_tests/test_status.py @@ -12,10 +12,10 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock import test_utils -from mock import MagicMock, patch +from unittest.mock import MagicMock, patch with patch('charmhelpers.contrib.hardening.harden.harden') as mock_dec: mock_dec.side_effect = (lambda *dargs, **dkwargs: lambda f: diff --git a/unit_tests/test_tuning.py b/unit_tests/test_tuning.py index bb0631f4..92e61d52 100644 --- a/unit_tests/test_tuning.py +++ b/unit_tests/test_tuning.py @@ -1,5 +1,5 @@ __author__ = 'Chris Holcombe ' -from mock import patch, call +from unittest.mock import patch, call import test_utils import charms_ceph.utils as ceph diff --git a/unit_tests/test_upgrade.py b/unit_tests/test_upgrade.py index efc2800e..dd3f223b 100644 --- a/unit_tests/test_upgrade.py +++ b/unit_tests/test_upgrade.py @@ -1,4 +1,4 @@ -from mock import call, patch +from unittest.mock import call, patch from test_utils import CharmTestCase from ceph_hooks import check_for_upgrade, notify_mon_of_upgrade diff --git a/unit_tests/test_utils.py b/unit_tests/test_utils.py index 639552e2..b8d41361 100644 --- a/unit_tests/test_utils.py +++ b/unit_tests/test_utils.py @@ -19,7 +19,7 @@ import sys import yaml from contextlib import contextmanager -from mock import patch, MagicMock +from unittest.mock import patch, MagicMock # python-apt is not installed as part of test-requirements but is imported by # some charmhelpers modules so create a fake import.