From 34aaaf2eb5dccba9b31010642052d12c11cc269d Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 31 Mar 2020 13:57:21 -0500 Subject: [PATCH] Use unittest.mock instead of third party mock Now that we no longer support py27, we can use the standard library unittest.mock module instead of the third party mock lib. Change-Id: I597461bc2ce6a480ea18950ded606ef7db717f2d Signed-off-by: Sean McGinnis --- lower-constraints.txt | 1 - oslo_i18n/tests/test_factory.py | 3 ++- oslo_i18n/tests/test_gettextutils.py | 2 +- oslo_i18n/tests/test_handler.py | 2 +- oslo_i18n/tests/test_logging.py | 3 ++- oslo_i18n/tests/test_message.py | 2 +- oslo_i18n/tests/test_public_api.py | 6 ++---- oslo_i18n/tests/test_translate.py | 3 ++- test-requirements.txt | 1 - 9 files changed, 11 insertions(+), 12 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index c6c836d..9fadd9e 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -19,7 +19,6 @@ keystoneauth1==3.4.0 linecache2==1.0.0 MarkupSafe==1.0 mccabe==0.2.1 -mock==2.0.0 mox3==0.20.0 netaddr==0.7.18 openstackdocstheme==1.18.1 diff --git a/oslo_i18n/tests/test_factory.py b/oslo_i18n/tests/test_factory.py index d99625d..34effb5 100644 --- a/oslo_i18n/tests/test_factory.py +++ b/oslo_i18n/tests/test_factory.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslotest import base as test_base import six diff --git a/oslo_i18n/tests/test_gettextutils.py b/oslo_i18n/tests/test_gettextutils.py index 2eca069..0592542 100644 --- a/oslo_i18n/tests/test_gettextutils.py +++ b/oslo_i18n/tests/test_gettextutils.py @@ -16,9 +16,9 @@ import gettext import logging +from unittest import mock from babel import localedata -import mock from oslotest import base as test_base import six diff --git a/oslo_i18n/tests/test_handler.py b/oslo_i18n/tests/test_handler.py index b0c678e..ffa9f8e 100644 --- a/oslo_i18n/tests/test_handler.py +++ b/oslo_i18n/tests/test_handler.py @@ -15,8 +15,8 @@ # under the License. import logging +from unittest import mock -import mock from oslotest import base as test_base import six diff --git a/oslo_i18n/tests/test_logging.py b/oslo_i18n/tests/test_logging.py index 07e5c71..862b7b7 100644 --- a/oslo_i18n/tests/test_logging.py +++ b/oslo_i18n/tests/test_logging.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslotest import base as test_base from oslo_i18n import _factory diff --git a/oslo_i18n/tests/test_message.py b/oslo_i18n/tests/test_message.py index 0a57abc..9e5fa04 100644 --- a/oslo_i18n/tests/test_message.py +++ b/oslo_i18n/tests/test_message.py @@ -17,9 +17,9 @@ from __future__ import unicode_literals import logging +from unittest import mock import warnings -import mock from oslotest import base as test_base import six import testtools diff --git a/oslo_i18n/tests/test_public_api.py b/oslo_i18n/tests/test_public_api.py index d419105..c08384a 100644 --- a/oslo_i18n/tests/test_public_api.py +++ b/oslo_i18n/tests/test_public_api.py @@ -9,12 +9,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. -"""A few tests that use the public API to ensure the imports work. -""" +"""A few tests that use the public API to ensure the imports work.""" import unittest - -import mock +from unittest import mock import oslo_i18n from oslo_i18n import _lazy diff --git a/oslo_i18n/tests/test_translate.py b/oslo_i18n/tests/test_translate.py index 335b28c..589df2e 100644 --- a/oslo_i18n/tests/test_translate.py +++ b/oslo_i18n/tests/test_translate.py @@ -16,7 +16,8 @@ from __future__ import unicode_literals -import mock +from unittest import mock + from oslotest import base as test_base from oslo_i18n import _message diff --git a/test-requirements.txt b/test-requirements.txt index efc469b..57ddc52 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -4,7 +4,6 @@ hacking>=3.0,<3.1.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0 -mock>=2.0.0 # BSD oslotest>=3.2.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 testscenarios>=0.4 # Apache-2.0/BSD