From 5b6f800139b541b8c4ed7fb22d26261f969c1d06 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sat, 18 Apr 2020 11:59:13 -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: I96263b774551821745a2345ffb2df3bf2a2dcf05 Signed-off-by: Sean McGinnis --- saharaclient/tests/unit/osc/test_plugin.py | 2 +- saharaclient/tests/unit/osc/v1/fakes.py | 2 +- saharaclient/tests/unit/osc/v1/test_clusters.py | 2 +- saharaclient/tests/unit/osc/v1/test_data_sources.py | 2 +- saharaclient/tests/unit/osc/v1/test_images.py | 2 +- saharaclient/tests/unit/osc/v1/test_job_binaries.py | 2 +- saharaclient/tests/unit/osc/v1/test_job_templates.py | 2 +- saharaclient/tests/unit/osc/v1/test_job_types.py | 2 +- saharaclient/tests/unit/osc/v1/test_jobs.py | 2 +- saharaclient/tests/unit/osc/v1/test_node_group_templates.py | 2 +- saharaclient/tests/unit/osc/v1/test_plugins.py | 3 ++- saharaclient/tests/unit/osc/v1/test_utils.py | 2 +- saharaclient/tests/unit/osc/v2/test_clusters.py | 2 +- saharaclient/tests/unit/osc/v2/test_data_sources.py | 2 +- saharaclient/tests/unit/osc/v2/test_images.py | 2 +- saharaclient/tests/unit/osc/v2/test_job_binaries.py | 2 +- saharaclient/tests/unit/osc/v2/test_job_templates.py | 2 +- saharaclient/tests/unit/osc/v2/test_job_types.py | 2 +- saharaclient/tests/unit/osc/v2/test_jobs.py | 2 +- saharaclient/tests/unit/osc/v2/test_node_group_templates.py | 2 +- saharaclient/tests/unit/osc/v2/test_plugins.py | 3 ++- saharaclient/tests/unit/test_data_sources.py | 2 +- saharaclient/tests/unit/test_manager.py | 2 +- test-requirements.txt | 1 - 24 files changed, 25 insertions(+), 24 deletions(-) diff --git a/saharaclient/tests/unit/osc/test_plugin.py b/saharaclient/tests/unit/osc/test_plugin.py index cf5ac7d..8d4d9f0 100644 --- a/saharaclient/tests/unit/osc/test_plugin.py +++ b/saharaclient/tests/unit/osc/test_plugin.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from saharaclient.osc import plugin from saharaclient.tests.unit import base diff --git a/saharaclient/tests/unit/osc/v1/fakes.py b/saharaclient/tests/unit/osc/v1/fakes.py index af374b8..a26a23e 100644 --- a/saharaclient/tests/unit/osc/v1/fakes.py +++ b/saharaclient/tests/unit/osc/v1/fakes.py @@ -14,8 +14,8 @@ # limitations under the License. -import mock from osc_lib.tests import utils +from unittest import mock class TestDataProcessing(utils.TestCommand): diff --git a/saharaclient/tests/unit/osc/v1/test_clusters.py b/saharaclient/tests/unit/osc/v1/test_clusters.py index 7695ad1..0437c5f 100644 --- a/saharaclient/tests/unit/osc/v1/test_clusters.py +++ b/saharaclient/tests/unit/osc/v1/test_clusters.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import cluster_templates as api_ct from saharaclient.api import clusters as api_cl diff --git a/saharaclient/tests/unit/osc/v1/test_data_sources.py b/saharaclient/tests/unit/osc/v1/test_data_sources.py index c37d8ab..e5556f8 100644 --- a/saharaclient/tests/unit/osc/v1/test_data_sources.py +++ b/saharaclient/tests/unit/osc/v1/test_data_sources.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils import testtools +from unittest import mock from saharaclient.api import data_sources as api_ds from saharaclient.osc.v1 import data_sources as osc_ds diff --git a/saharaclient/tests/unit/osc/v1/test_images.py b/saharaclient/tests/unit/osc/v1/test_images.py index 006a0b4..1ea188b 100644 --- a/saharaclient/tests/unit/osc/v1/test_images.py +++ b/saharaclient/tests/unit/osc/v1/test_images.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import images as api_images from saharaclient.osc.v1 import images as osc_images diff --git a/saharaclient/tests/unit/osc/v1/test_job_binaries.py b/saharaclient/tests/unit/osc/v1/test_job_binaries.py index 0b4b66e..96da3c3 100644 --- a/saharaclient/tests/unit/osc/v1/test_job_binaries.py +++ b/saharaclient/tests/unit/osc/v1/test_job_binaries.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_u import testtools +from unittest import mock from saharaclient.api import job_binaries as api_jb from saharaclient.osc.v1 import job_binaries as osc_jb diff --git a/saharaclient/tests/unit/osc/v1/test_job_templates.py b/saharaclient/tests/unit/osc/v1/test_job_templates.py index 9b6b711..1da4597 100644 --- a/saharaclient/tests/unit/osc/v1/test_job_templates.py +++ b/saharaclient/tests/unit/osc/v1/test_job_templates.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import jobs as api_j from saharaclient.osc.v1 import job_templates as osc_j diff --git a/saharaclient/tests/unit/osc/v1/test_job_types.py b/saharaclient/tests/unit/osc/v1/test_job_types.py index ccc7be3..8d1a319 100644 --- a/saharaclient/tests/unit/osc/v1/test_job_types.py +++ b/saharaclient/tests/unit/osc/v1/test_job_types.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from saharaclient.api import job_types as api_jt from saharaclient.api import jobs as api_j diff --git a/saharaclient/tests/unit/osc/v1/test_jobs.py b/saharaclient/tests/unit/osc/v1/test_jobs.py index fc325f2..1aeac50 100644 --- a/saharaclient/tests/unit/osc/v1/test_jobs.py +++ b/saharaclient/tests/unit/osc/v1/test_jobs.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import job_executions as api_je from saharaclient.osc.v1 import jobs as osc_je diff --git a/saharaclient/tests/unit/osc/v1/test_node_group_templates.py b/saharaclient/tests/unit/osc/v1/test_node_group_templates.py index 10dc5aa..e9efb20 100644 --- a/saharaclient/tests/unit/osc/v1/test_node_group_templates.py +++ b/saharaclient/tests/unit/osc/v1/test_node_group_templates.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import node_group_templates as api_ngt from saharaclient.osc.v1 import node_group_templates as osc_ngt diff --git a/saharaclient/tests/unit/osc/v1/test_plugins.py b/saharaclient/tests/unit/osc/v1/test_plugins.py index fad361d..75c49b1 100644 --- a/saharaclient/tests/unit/osc/v1/test_plugins.py +++ b/saharaclient/tests/unit/osc/v1/test_plugins.py @@ -13,7 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock + from oslo_serialization import jsonutils as json from saharaclient.api import plugins as api_plugins diff --git a/saharaclient/tests/unit/osc/v1/test_utils.py b/saharaclient/tests/unit/osc/v1/test_utils.py index 59ddbdc..4f70cf5 100644 --- a/saharaclient/tests/unit/osc/v1/test_utils.py +++ b/saharaclient/tests/unit/osc/v1/test_utils.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from saharaclient.osc import utils from saharaclient.tests.unit import base diff --git a/saharaclient/tests/unit/osc/v2/test_clusters.py b/saharaclient/tests/unit/osc/v2/test_clusters.py index 6bbb725..99c07b6 100644 --- a/saharaclient/tests/unit/osc/v2/test_clusters.py +++ b/saharaclient/tests/unit/osc/v2/test_clusters.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import cluster_templates as api_ct from saharaclient.api import clusters as api_cl diff --git a/saharaclient/tests/unit/osc/v2/test_data_sources.py b/saharaclient/tests/unit/osc/v2/test_data_sources.py index 27af0b5..1c2c389 100644 --- a/saharaclient/tests/unit/osc/v2/test_data_sources.py +++ b/saharaclient/tests/unit/osc/v2/test_data_sources.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import data_sources as api_ds from saharaclient.osc.v1 import data_sources as osc_ds diff --git a/saharaclient/tests/unit/osc/v2/test_images.py b/saharaclient/tests/unit/osc/v2/test_images.py index 4e94001..1855bdf 100644 --- a/saharaclient/tests/unit/osc/v2/test_images.py +++ b/saharaclient/tests/unit/osc/v2/test_images.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import images as api_images from saharaclient.osc.v1 import images as osc_images diff --git a/saharaclient/tests/unit/osc/v2/test_job_binaries.py b/saharaclient/tests/unit/osc/v2/test_job_binaries.py index ee94e83..93d889a 100644 --- a/saharaclient/tests/unit/osc/v2/test_job_binaries.py +++ b/saharaclient/tests/unit/osc/v2/test_job_binaries.py @@ -13,9 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_u import testtools +from unittest import mock from saharaclient.api import job_binaries as api_jb from saharaclient.osc.v1 import job_binaries as osc_jb diff --git a/saharaclient/tests/unit/osc/v2/test_job_templates.py b/saharaclient/tests/unit/osc/v2/test_job_templates.py index 4060fb3..08d6c26 100644 --- a/saharaclient/tests/unit/osc/v2/test_job_templates.py +++ b/saharaclient/tests/unit/osc/v2/test_job_templates.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api.v2 import job_templates as api_j from saharaclient.osc.v2 import job_templates as osc_j diff --git a/saharaclient/tests/unit/osc/v2/test_job_types.py b/saharaclient/tests/unit/osc/v2/test_job_types.py index 130f218..477f147 100644 --- a/saharaclient/tests/unit/osc/v2/test_job_types.py +++ b/saharaclient/tests/unit/osc/v2/test_job_types.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from saharaclient.api import job_types as api_jt from saharaclient.api.v2 import job_templates as api_job_templates diff --git a/saharaclient/tests/unit/osc/v2/test_jobs.py b/saharaclient/tests/unit/osc/v2/test_jobs.py index 5eb0e3b..5c880db 100644 --- a/saharaclient/tests/unit/osc/v2/test_jobs.py +++ b/saharaclient/tests/unit/osc/v2/test_jobs.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api.v2 import jobs as api_j from saharaclient.osc.v2 import jobs as osc_j diff --git a/saharaclient/tests/unit/osc/v2/test_node_group_templates.py b/saharaclient/tests/unit/osc/v2/test_node_group_templates.py index 3eef3b0..5555262 100644 --- a/saharaclient/tests/unit/osc/v2/test_node_group_templates.py +++ b/saharaclient/tests/unit/osc/v2/test_node_group_templates.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock from osc_lib.tests import utils as osc_utils +from unittest import mock from saharaclient.api import node_group_templates as api_ngt from saharaclient.osc.v2 import node_group_templates as osc_ngt diff --git a/saharaclient/tests/unit/osc/v2/test_plugins.py b/saharaclient/tests/unit/osc/v2/test_plugins.py index 6fcf972..ae72e83 100644 --- a/saharaclient/tests/unit/osc/v2/test_plugins.py +++ b/saharaclient/tests/unit/osc/v2/test_plugins.py @@ -13,7 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock + from oslo_serialization import jsonutils as json from saharaclient.api import plugins as api_plugins diff --git a/saharaclient/tests/unit/test_data_sources.py b/saharaclient/tests/unit/test_data_sources.py index 594d654..7da69fb 100644 --- a/saharaclient/tests/unit/test_data_sources.py +++ b/saharaclient/tests/unit/test_data_sources.py @@ -14,8 +14,8 @@ from saharaclient.api import data_sources as ds from saharaclient.tests.unit import base +from unittest import mock -import mock from oslo_serialization import jsonutils as json diff --git a/saharaclient/tests/unit/test_manager.py b/saharaclient/tests/unit/test_manager.py index 176154f..3d91b08 100644 --- a/saharaclient/tests/unit/test_manager.py +++ b/saharaclient/tests/unit/test_manager.py @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from saharaclient.api import base from saharaclient.tests.unit import base as test_base diff --git a/test-requirements.txt b/test-requirements.txt index 6927cd7..d0aa9bf 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,6 @@ hacking>=3.0,<3.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 -mock>=2.0.0 # BSD oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0 -- cgit v1.2.1