From 6fc7248d361296874ff56187718e854f882d3d92 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sat, 18 Apr 2020 12:00:24 -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: I9f6ec4261e9d1aa5921706ace8b5c4a66f0d7021 Signed-off-by: Sean McGinnis --- .../tests/unit/plugins/cdh/base_plugin_utils_test.py | 2 +- .../tests/unit/plugins/cdh/test_cloudera_utils.py | 2 +- .../tests/unit/plugins/cdh/test_confighints_helper.py | 2 +- sahara_plugin_cdh/tests/unit/plugins/cdh/test_health.py | 3 ++- .../tests/unit/plugins/cdh/v5_11_0/test_deploy.py | 2 +- .../tests/unit/plugins/cdh/v5_11_0/test_edp_engine.py | 2 +- .../tests/unit/plugins/cdh/v5_11_0/test_spark_engine.py | 2 +- .../tests/unit/plugins/cdh/v5_11_0/test_versionhandler.py | 3 ++- sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_deploy.py | 2 +- .../tests/unit/plugins/cdh/v5_7_0/test_edp_engine.py | 2 +- .../tests/unit/plugins/cdh/v5_7_0/test_spark_engine.py | 2 +- .../tests/unit/plugins/cdh/v5_7_0/test_versionhandler.py | 3 ++- sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_deploy.py | 2 +- .../tests/unit/plugins/cdh/v5_9_0/test_edp_engine.py | 2 +- .../tests/unit/plugins/cdh/v5_9_0/test_spark_engine.py | 2 +- .../tests/unit/plugins/cdh/v5_9_0/test_versionhandler.py | 3 ++- test-requirements.txt | 1 - 17 files changed, 20 insertions(+), 17 deletions(-) diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/base_plugin_utils_test.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/base_plugin_utils_test.py index 055c0f0..491f6ef 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/base_plugin_utils_test.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/base_plugin_utils_test.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 sahara.plugins import utils from sahara_plugin_cdh.i18n import _ diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/test_cloudera_utils.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/test_cloudera_utils.py index 4436eb7..d77365b 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/test_cloudera_utils.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/test_cloudera_utils.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock import testtools +from unittest import mock from sahara_plugin_cdh.plugins.cdh import cloudera_utils as cu from sahara_plugin_cdh.tests.unit import base diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/test_confighints_helper.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/test_confighints_helper.py index 6352eae..3497717 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/test_confighints_helper.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/test_confighints_helper.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 sahara_plugin_cdh.plugins.cdh import confighints_helper as ch_helper from sahara_plugin_cdh.tests.unit import base as sahara_base diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/test_health.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/test_health.py index a756f06..592d2a8 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/test_health.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/test_health.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 + import six import testtools diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_deploy.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_deploy.py index 6cff29e..2c50191 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_deploy.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_deploy.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 sahara_plugin_cdh.plugins.cdh.v5_11_0 import deploy from sahara_plugin_cdh.tests.unit import base diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_edp_engine.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_edp_engine.py index 6322d59..1ae7fa1 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_edp_engine.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_edp_engine.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 sahara.plugins import base as pb from sahara.plugins import edp diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_spark_engine.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_spark_engine.py index d970059..465c3f6 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_spark_engine.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_spark_engine.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock import testtools +from unittest import mock from sahara.plugins import base as pb from sahara.plugins import conductor diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_versionhandler.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_versionhandler.py index 2a740ee..46620b3 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_versionhandler.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_11_0/test_versionhandler.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 + import six from sahara.plugins import base as pb diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_deploy.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_deploy.py index a98ee45..0c61914 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_deploy.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_deploy.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 sahara_plugin_cdh.plugins.cdh.v5_7_0 import deploy from sahara_plugin_cdh.tests.unit import base diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_edp_engine.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_edp_engine.py index 653a757..4edc5f7 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_edp_engine.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_edp_engine.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 sahara.plugins import base as pb from sahara.plugins import edp diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_spark_engine.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_spark_engine.py index 66a7ff1..c8ed79d 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_spark_engine.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_spark_engine.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock import testtools +from unittest import mock from sahara.plugins import base as pb from sahara.plugins import conductor diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_versionhandler.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_versionhandler.py index 83f6313..f5df888 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_versionhandler.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_7_0/test_versionhandler.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 + import six from sahara.plugins import base as pb diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_deploy.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_deploy.py index fbd9def..fe31d9a 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_deploy.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_deploy.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 sahara_plugin_cdh.plugins.cdh.v5_9_0 import deploy from sahara_plugin_cdh.tests.unit import base diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_edp_engine.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_edp_engine.py index 10754b8..d3ee9ea 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_edp_engine.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_edp_engine.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 sahara.plugins import base as pb from sahara.plugins import edp diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_spark_engine.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_spark_engine.py index da7eea0..a3faf68 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_spark_engine.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_spark_engine.py @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock import testtools +from unittest import mock from sahara.plugins import base as pb from sahara.plugins import conductor diff --git a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_versionhandler.py b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_versionhandler.py index a8764a1..543c0c9 100644 --- a/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_versionhandler.py +++ b/sahara_plugin_cdh/tests/unit/plugins/cdh/v5_9_0/test_versionhandler.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 + import six from sahara.plugins import base as pb diff --git a/test-requirements.txt b/test-requirements.txt index c572e69..06966da 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -9,7 +9,6 @@ bashate>=0.5.1 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0 fixtures>=3.0.0 # Apache-2.0/BSD -mock>=2.0.0 # BSD oslotest>=3.2.0 # Apache-2.0 stestr>=1.0.0 # Apache-2.0 pylint==1.4.5 # GPLv2