From ced4d8eae4a6399251840fb5ef95eb74ec497464 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 31 Mar 2020 13:59:44 -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: Ib1f840f0cb778219f7640a2ca307847a090de6aa Signed-off-by: Sean McGinnis --- lower-constraints.txt | 1 - oslo_policy/tests/test_checks.py | 3 ++- oslo_policy/tests/test_external.py | 3 ++- oslo_policy/tests/test_generator.py | 2 +- oslo_policy/tests/test_parser.py | 3 ++- oslo_policy/tests/test_policy.py | 2 +- oslo_policy/tests/test_shell.py | 3 ++- oslo_policy/tests/test_sphinxpolicygen.py | 3 ++- 8 files changed, 12 insertions(+), 8 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 32f1f7da..36e332dc 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 msgpack-python==0.4.0 netaddr==0.7.18 diff --git a/oslo_policy/tests/test_checks.py b/oslo_policy/tests/test_checks.py index 8c2f143b..61b5154e 100644 --- a/oslo_policy/tests/test_checks.py +++ b/oslo_policy/tests/test_checks.py @@ -13,7 +13,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_policy import _checks diff --git a/oslo_policy/tests/test_external.py b/oslo_policy/tests/test_external.py index 92ff539d..80fdec8e 100644 --- a/oslo_policy/tests/test_external.py +++ b/oslo_policy/tests/test_external.py @@ -14,7 +14,8 @@ # under the License. import json -import mock +from unittest import mock + from oslo_serialization import jsonutils from requests_mock.contrib import fixture as rm_fixture import six.moves.urllib.parse as urlparse diff --git a/oslo_policy/tests/test_generator.py b/oslo_policy/tests/test_generator.py index bb3ee894..33d420ee 100644 --- a/oslo_policy/tests/test_generator.py +++ b/oslo_policy/tests/test_generator.py @@ -10,9 +10,9 @@ # under the License. import operator +from unittest import mock import warnings -import mock from oslo_config import cfg import stevedore import testtools diff --git a/oslo_policy/tests/test_parser.py b/oslo_policy/tests/test_parser.py index df5bbbc6..edfd475e 100644 --- a/oslo_policy/tests/test_parser.py +++ b/oslo_policy/tests/test_parser.py @@ -13,7 +13,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_policy/tests/test_policy.py b/oslo_policy/tests/test_policy.py index bc41054d..f3f75b0b 100644 --- a/oslo_policy/tests/test_policy.py +++ b/oslo_policy/tests/test_policy.py @@ -16,8 +16,8 @@ """Test of Policy Engine""" import os +from unittest import mock -import mock from oslo_config import cfg from oslo_context import context from oslo_serialization import jsonutils diff --git a/oslo_policy/tests/test_shell.py b/oslo_policy/tests/test_shell.py index 32dad51b..0eb6aa65 100644 --- a/oslo_policy/tests/test_shell.py +++ b/oslo_policy/tests/test_shell.py @@ -14,7 +14,8 @@ # under the License. import copy -import mock +from unittest import mock + from oslo_serialization import jsonutils from oslo_policy import shell diff --git a/oslo_policy/tests/test_sphinxpolicygen.py b/oslo_policy/tests/test_sphinxpolicygen.py index ad65ec3d..461d6c5f 100644 --- a/oslo_policy/tests/test_sphinxpolicygen.py +++ b/oslo_policy/tests/test_sphinxpolicygen.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslotest import base from oslo_policy import sphinxpolicygen