From 88f09512fff87bb7c3eeac68979a12ee92da91f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Tue, 9 Jun 2020 12:10:49 +0200 Subject: [PATCH] Use unittest.mock instead of mock The mock third party library was needed for mock support in py2 runtimes. Since we now only support py36 and later, we can use the standard lib unittest.mock module instead. Change-Id: I4e885ce16080d302552217280b88b9dee3839555 --- lower-constraints.txt | 1 - .../tests/unit/plugins/vanilla/hadoop2/test_config_helper.py | 2 +- .../tests/unit/plugins/vanilla/hadoop2/test_edp_engine.py | 2 +- .../tests/unit/plugins/vanilla/hadoop2/test_oozie_helper.py | 2 +- .../tests/unit/plugins/vanilla/hadoop2/test_plugin.py | 2 +- .../unit/plugins/vanilla/hadoop2/test_recommendation_utils.py | 2 +- .../tests/unit/plugins/vanilla/hadoop2/test_run_scripts.py | 2 +- .../tests/unit/plugins/vanilla/hadoop2/test_scaling.py | 2 +- .../tests/unit/plugins/vanilla/hadoop2/test_starting_scripts.py | 2 +- .../tests/unit/plugins/vanilla/hadoop2/test_utils.py | 2 +- .../tests/unit/plugins/vanilla/test_confighints_helper.py | 2 +- .../tests/unit/plugins/vanilla/v2_7_1/test_config_helper.py | 2 +- .../tests/unit/plugins/vanilla/v2_7_1/test_edp_engine.py | 2 +- .../tests/unit/plugins/vanilla/v2_7_1/test_versionhandler.py | 2 +- .../tests/unit/plugins/vanilla/v2_7_5/test_config_helper.py | 2 +- .../tests/unit/plugins/vanilla/v2_7_5/test_edp_engine.py | 2 +- .../tests/unit/plugins/vanilla/v2_7_5/test_versionhandler.py | 2 +- .../tests/unit/plugins/vanilla/v2_8_2/test_config_helper.py | 2 +- .../tests/unit/plugins/vanilla/v2_8_2/test_edp_engine.py | 2 +- .../tests/unit/plugins/vanilla/v2_8_2/test_versionhandler.py | 2 +- test-requirements.txt | 1 - 21 files changed, 19 insertions(+), 21 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index 93e16e1..f6de0c1 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -57,7 +57,6 @@ Mako==1.0.7 MarkupSafe==1.1.0 mccabe==0.5.3 microversion-parse==0.2.1 -mock==2.0.0 monotonic==1.5 mox3==0.26.0 msgpack==0.6.1 diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_config_helper.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_config_helper.py index c8a2ef4..6950bce 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_config_helper.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_config_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 oslo_config import cfg from sahara.plugins import exceptions as ex diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_edp_engine.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_edp_engine.py index 9dd1ec7..5786bd6 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_edp_engine.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/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 exceptions as ex diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_oozie_helper.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_oozie_helper.py index 72debda..28cefd6 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_oozie_helper.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_oozie_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_vanilla.plugins.vanilla.hadoop2 import oozie_helper from sahara_plugin_vanilla.tests.unit import base diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_plugin.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_plugin.py index c0d3869..96db1e4 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_plugin.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/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 sahara.plugins import base as pb from sahara.plugins import conductor diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_recommendation_utils.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_recommendation_utils.py index c8b0bf1..198f362 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_recommendation_utils.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_recommendation_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 import testtools from sahara_plugin_vanilla.plugins.vanilla.hadoop2 import recommendations_utils diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_run_scripts.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_run_scripts.py index d33e917..66cc41e 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_run_scripts.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_run_scripts.py @@ -14,7 +14,7 @@ # limitations under the License. from functools import wraps -import mock +from unittest import mock def mock_event_wrapper(*args, **kwargs): diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_scaling.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_scaling.py index 69146a0..fc56306 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_scaling.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_scaling.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_vanilla.i18n import _ from sahara_plugin_vanilla.plugins.vanilla.hadoop2 import config_helper diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_starting_scripts.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_starting_scripts.py index 5b60519..656e816 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_starting_scripts.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_starting_scripts.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_vanilla.plugins.vanilla.hadoop2 import starting_scripts from sahara_plugin_vanilla.tests.unit import base diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_utils.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_utils.py index a39d31c..d81e405 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/test_utils.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/hadoop2/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 sahara.plugins import utils from sahara_plugin_vanilla.plugins.vanilla.hadoop2 import utils as u diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/test_confighints_helper.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/test_confighints_helper.py index effbdf5..f650030 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/test_confighints_helper.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/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_vanilla.plugins.vanilla import confighints_helper from sahara_plugin_vanilla.tests.unit import base as sahara_base diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_config_helper.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_config_helper.py index 2d4799a..fa43ca6 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_config_helper.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_config_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.plugins import provisioning as p from sahara_plugin_vanilla.plugins.vanilla.v2_7_1 import config_helper diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_edp_engine.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_edp_engine.py index 144a339..78877f8 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_edp_engine.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/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 edp from sahara_plugin_vanilla.plugins.vanilla.v2_7_1 import edp_engine diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_versionhandler.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_versionhandler.py index 119ffab..d28e95e 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_versionhandler.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_1/test_versionhandler.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 import six import testtools diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_config_helper.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_config_helper.py index 211b724..a0bb0d3 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_config_helper.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_config_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.plugins import provisioning as p from sahara_plugin_vanilla.plugins.vanilla.v2_7_5 import config_helper diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_edp_engine.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_edp_engine.py index 5da1fac..1009758 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_edp_engine.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/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 edp from sahara_plugin_vanilla.plugins.vanilla.v2_7_5 import edp_engine diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_versionhandler.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_versionhandler.py index 71ca403..a63b94e 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_versionhandler.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_7_5/test_versionhandler.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 import six import testtools diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_config_helper.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_config_helper.py index 0387e67..8d253c2 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_config_helper.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_config_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.plugins import provisioning as p from sahara_plugin_vanilla.plugins.vanilla.v2_8_2 import config_helper diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_edp_engine.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_edp_engine.py index 427b40f..9cb610c 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_edp_engine.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/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 edp from sahara.tests.unit import base as sahara_base diff --git a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_versionhandler.py b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_versionhandler.py index 98c15d7..3db7c09 100644 --- a/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_versionhandler.py +++ b/sahara_plugin_vanilla/tests/unit/plugins/vanilla/v2_8_2/test_versionhandler.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 import six import testtools diff --git a/test-requirements.txt b/test-requirements.txt index 9b3eb86..f3621b2 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