From 66b3da9689e293cdb819e989b6c469012b3db756 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Tue, 31 Mar 2020 14:06:30 -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: I2f8067eeb2aec62f098bfbb3770a67f1876ce7a2 Signed-off-by: Sean McGinnis --- lower-constraints.txt | 1 - oslo_config/tests/test_cfg.py | 2 +- oslo_config/tests/test_generator.py | 2 +- oslo_config/tests/test_sphinxconfiggen.py | 3 ++- oslo_config/tests/test_sphinxext.py | 2 +- oslo_config/tests/test_validator.py | 3 ++- test-requirements.txt | 3 --- 7 files changed, 7 insertions(+), 9 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 7c453f28..d1b2522a 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==3.0.0 mox3==0.20.0 mypy==0.720 netaddr==0.7.18 diff --git a/oslo_config/tests/test_cfg.py b/oslo_config/tests/test_cfg.py index 98bd8e38..ac457804 100644 --- a/oslo_config/tests/test_cfg.py +++ b/oslo_config/tests/test_cfg.py @@ -21,9 +21,9 @@ import os import shutil import sys import tempfile +from unittest import mock import fixtures -import mock from oslotest import base import testscenarios diff --git a/oslo_config/tests/test_generator.py b/oslo_config/tests/test_generator.py index becd49a1..9ddb56f7 100644 --- a/oslo_config/tests/test_generator.py +++ b/oslo_config/tests/test_generator.py @@ -15,9 +15,9 @@ import io import sys import textwrap +from unittest import mock import fixtures -import mock from oslotest import base import tempfile import testscenarios diff --git a/oslo_config/tests/test_sphinxconfiggen.py b/oslo_config/tests/test_sphinxconfiggen.py index 982641ed..e4ddcbab 100644 --- a/oslo_config/tests/test_sphinxconfiggen.py +++ b/oslo_config/tests/test_sphinxconfiggen.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_config import sphinxconfiggen diff --git a/oslo_config/tests/test_sphinxext.py b/oslo_config/tests/test_sphinxext.py index b35af717..340ee4ed 100644 --- a/oslo_config/tests/test_sphinxext.py +++ b/oslo_config/tests/test_sphinxext.py @@ -11,8 +11,8 @@ # under the License. import textwrap +from unittest import mock -import mock from oslotest import base from oslo_config import cfg diff --git a/oslo_config/tests/test_validator.py b/oslo_config/tests/test_validator.py index a2ffde7c..de912ac8 100644 --- a/oslo_config/tests/test_validator.py +++ b/oslo_config/tests/test_validator.py @@ -12,7 +12,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_config import cfg diff --git a/test-requirements.txt b/test-requirements.txt index 47086b2b..96ff91f8 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -21,9 +21,6 @@ oslo.log>=3.36.0 # Apache-2.0 # deps = {[testenv]deps} coverage coverage!=4.4,>=4.0 # Apache-2.0 -# we can switch to unittest.mock once we drop support for Python 3.6 as that -# includes https://bugs.python.org/issue32933 -mock>=3.0.0 # BSD requests_mock>=1.5.0 # Apache-2.0 # Bandit security code scanner