From 6a4d27f7b771e456928fe07a0c5f445484396fb0 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sat, 18 Apr 2020 11:57:01 -0500 Subject: 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: I76e01d55ff4d9095a6dbf520752042824225de73 Signed-off-by: Sean McGinnis --- osprofiler/tests/unit/cmd/test_shell.py | 2 +- osprofiler/tests/unit/drivers/test_elasticsearch.py | 2 +- osprofiler/tests/unit/drivers/test_jaeger.py | 2 +- osprofiler/tests/unit/drivers/test_loginsight.py | 2 +- osprofiler/tests/unit/drivers/test_messaging.py | 2 +- osprofiler/tests/unit/drivers/test_mongodb.py | 2 +- osprofiler/tests/unit/drivers/test_redis_driver.py | 3 ++- osprofiler/tests/unit/test_initializer.py | 2 +- osprofiler/tests/unit/test_notifier.py | 2 +- osprofiler/tests/unit/test_opts.py | 3 ++- osprofiler/tests/unit/test_profiler.py | 2 +- osprofiler/tests/unit/test_sqlalchemy.py | 2 +- osprofiler/tests/unit/test_utils.py | 2 +- osprofiler/tests/unit/test_web.py | 3 ++- test-requirements.txt | 1 - 15 files changed, 17 insertions(+), 15 deletions(-) diff --git a/osprofiler/tests/unit/cmd/test_shell.py b/osprofiler/tests/unit/cmd/test_shell.py index f55f4b2..845d8d9 100644 --- a/osprofiler/tests/unit/cmd/test_shell.py +++ b/osprofiler/tests/unit/cmd/test_shell.py @@ -16,9 +16,9 @@ import json import os import sys +from unittest import mock import ddt -import mock import six from osprofiler.cmd import shell diff --git a/osprofiler/tests/unit/drivers/test_elasticsearch.py b/osprofiler/tests/unit/drivers/test_elasticsearch.py index c7385de..a73b9bd 100644 --- a/osprofiler/tests/unit/drivers/test_elasticsearch.py +++ b/osprofiler/tests/unit/drivers/test_elasticsearch.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from osprofiler.drivers.elasticsearch_driver import ElasticsearchDriver from osprofiler.tests import test diff --git a/osprofiler/tests/unit/drivers/test_jaeger.py b/osprofiler/tests/unit/drivers/test_jaeger.py index 661d75b..e59e69b 100644 --- a/osprofiler/tests/unit/drivers/test_jaeger.py +++ b/osprofiler/tests/unit/drivers/test_jaeger.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from osprofiler.drivers import jaeger from osprofiler.tests import test diff --git a/osprofiler/tests/unit/drivers/test_loginsight.py b/osprofiler/tests/unit/drivers/test_loginsight.py index 5e28aee..b05ea98 100644 --- a/osprofiler/tests/unit/drivers/test_loginsight.py +++ b/osprofiler/tests/unit/drivers/test_loginsight.py @@ -14,9 +14,9 @@ # under the License. import json +from unittest import mock import ddt -import mock from osprofiler.drivers import loginsight from osprofiler import exc diff --git a/osprofiler/tests/unit/drivers/test_messaging.py b/osprofiler/tests/unit/drivers/test_messaging.py index 9a2c0a3..baa911b 100644 --- a/osprofiler/tests/unit/drivers/test_messaging.py +++ b/osprofiler/tests/unit/drivers/test_messaging.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from osprofiler.drivers import base from osprofiler.tests import test diff --git a/osprofiler/tests/unit/drivers/test_mongodb.py b/osprofiler/tests/unit/drivers/test_mongodb.py index 2a6b782..b11b97f 100644 --- a/osprofiler/tests/unit/drivers/test_mongodb.py +++ b/osprofiler/tests/unit/drivers/test_mongodb.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from osprofiler.drivers.mongodb import MongoDB from osprofiler.tests import test diff --git a/osprofiler/tests/unit/drivers/test_redis_driver.py b/osprofiler/tests/unit/drivers/test_redis_driver.py index 369c733..2e7a8e0 100644 --- a/osprofiler/tests/unit/drivers/test_redis_driver.py +++ b/osprofiler/tests/unit/drivers/test_redis_driver.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_serialization import jsonutils from osprofiler.drivers.redis_driver import Redis diff --git a/osprofiler/tests/unit/test_initializer.py b/osprofiler/tests/unit/test_initializer.py index abb69d3..ef8169a 100644 --- a/osprofiler/tests/unit/test_initializer.py +++ b/osprofiler/tests/unit/test_initializer.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock import testtools +from unittest import mock from osprofiler import initializer diff --git a/osprofiler/tests/unit/test_notifier.py b/osprofiler/tests/unit/test_notifier.py index 8e658fe..47229c8 100644 --- a/osprofiler/tests/unit/test_notifier.py +++ b/osprofiler/tests/unit/test_notifier.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from osprofiler import notifier from osprofiler.tests import test diff --git a/osprofiler/tests/unit/test_opts.py b/osprofiler/tests/unit/test_opts.py index c5963b9..31af2ab 100644 --- a/osprofiler/tests/unit/test_opts.py +++ b/osprofiler/tests/unit/test_opts.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_config import fixture from osprofiler import opts diff --git a/osprofiler/tests/unit/test_profiler.py b/osprofiler/tests/unit/test_profiler.py index fbe0ccd..0f0fcb5 100644 --- a/osprofiler/tests/unit/test_profiler.py +++ b/osprofiler/tests/unit/test_profiler.py @@ -17,8 +17,8 @@ import collections import copy import datetime import re +from unittest import mock -import mock import six from osprofiler import profiler diff --git a/osprofiler/tests/unit/test_sqlalchemy.py b/osprofiler/tests/unit/test_sqlalchemy.py index 3ccf6bf..4fb71c4 100644 --- a/osprofiler/tests/unit/test_sqlalchemy.py +++ b/osprofiler/tests/unit/test_sqlalchemy.py @@ -14,8 +14,8 @@ # under the License. import contextlib +from unittest import mock -import mock from osprofiler import sqlalchemy from osprofiler.tests import test diff --git a/osprofiler/tests/unit/test_utils.py b/osprofiler/tests/unit/test_utils.py index ffb7b09..2239aa1 100644 --- a/osprofiler/tests/unit/test_utils.py +++ b/osprofiler/tests/unit/test_utils.py @@ -16,9 +16,9 @@ import base64 import hashlib import hmac +from unittest import mock import uuid -import mock from osprofiler import _utils as utils from osprofiler.tests import test diff --git a/osprofiler/tests/unit/test_web.py b/osprofiler/tests/unit/test_web.py index 61015cb..7ceade0 100644 --- a/osprofiler/tests/unit/test_web.py +++ b/osprofiler/tests/unit/test_web.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from webob import response as webob_response from osprofiler import _utils as utils diff --git a/test-requirements.txt b/test-requirements.txt index 472891b..cb4349a 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -2,7 +2,6 @@ hacking>=3.0,<3.1.0 # Apache-2.0 coverage>=4.0 # Apache-2.0 ddt>=1.0.1 # MIT -mock>=2.0.0 # BSD stestr>=2.0.0 # Apache-2.0 testtools>=2.2.0 # MIT -- cgit v1.2.1