From 545a34c7511b6e6b5f1b59ca99891684303b4480 Mon Sep 17 00:00:00 2001 From: Sean McGinnis Date: Sat, 18 Apr 2020 11:54:27 -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: I6a4524c3e0458747646995615535e85cde2e155f Signed-off-by: Sean McGinnis --- mistral/tests/unit/actions/test_javascript_action.py | 2 +- mistral/tests/unit/actions/test_std_echo_action.py | 2 +- mistral/tests/unit/actions/test_std_email_action.py | 3 ++- mistral/tests/unit/actions/test_std_fail_action.py | 2 +- mistral/tests/unit/actions/test_std_http_action.py | 2 +- mistral/tests/unit/actions/test_std_mistral_http_action.py | 2 +- mistral/tests/unit/actions/test_std_ssh_action.py | 2 +- mistral/tests/unit/actions/test_std_test_dict_action.py | 2 +- mistral/tests/unit/api/base.py | 2 +- mistral/tests/unit/api/test_service.py | 3 ++- mistral/tests/unit/api/v2/test_action_executions.py | 2 +- mistral/tests/unit/api/v2/test_actions.py | 2 +- mistral/tests/unit/api/v2/test_cron_triggers.py | 2 +- mistral/tests/unit/api/v2/test_environment.py | 2 +- mistral/tests/unit/api/v2/test_event_trigger.py | 2 +- mistral/tests/unit/api/v2/test_executions.py | 2 +- mistral/tests/unit/api/v2/test_keycloak_auth.py | 3 ++- mistral/tests/unit/api/v2/test_members.py | 2 +- mistral/tests/unit/api/v2/test_services.py | 3 ++- mistral/tests/unit/api/v2/test_tasks.py | 2 +- mistral/tests/unit/api/v2/test_workbooks.py | 2 +- mistral/tests/unit/api/v2/test_workflows.py | 2 +- mistral/tests/unit/base.py | 2 +- mistral/tests/unit/engine/test_action_caching.py | 2 +- mistral/tests/unit/engine/test_action_context.py | 2 +- mistral/tests/unit/engine/test_action_defaults.py | 3 ++- mistral/tests/unit/engine/test_action_heartbeat_checker.py | 2 +- mistral/tests/unit/engine/test_action_heartbeat_sender.py | 2 +- mistral/tests/unit/engine/test_cron_trigger.py | 2 +- mistral/tests/unit/engine/test_default_engine.py | 2 +- mistral/tests/unit/engine/test_direct_workflow_rerun.py | 2 +- .../tests/unit/engine/test_direct_workflow_rerun_cancelled.py | 2 +- mistral/tests/unit/engine/test_disabled_yaql_conversion.py | 2 +- mistral/tests/unit/engine/test_environment.py | 3 ++- mistral/tests/unit/engine/test_error_handling.py | 3 ++- mistral/tests/unit/engine/test_javascript_action.py | 3 ++- mistral/tests/unit/engine/test_policies.py | 3 ++- mistral/tests/unit/engine/test_profiler.py | 2 +- mistral/tests/unit/engine/test_reverse_workflow_rerun.py | 2 +- .../tests/unit/engine/test_reverse_workflow_rerun_cancelled.py | 2 +- mistral/tests/unit/engine/test_run_action.py | 3 ++- mistral/tests/unit/engine/test_safe_rerun.py | 2 +- mistral/tests/unit/engine/test_state_info.py | 2 +- mistral/tests/unit/engine/test_subworkflows.py | 3 ++- mistral/tests/unit/engine/test_task_cancel.py | 2 +- mistral/tests/unit/engine/test_task_defaults.py | 3 ++- mistral/tests/unit/engine/test_task_publish.py | 2 +- mistral/tests/unit/engine/test_with_items.py | 3 ++- mistral/tests/unit/engine/test_workflow_resume.py | 3 ++- mistral/tests/unit/engine/test_yaql_functions.py | 2 +- mistral/tests/unit/executors/test_local_executor.py | 2 +- mistral/tests/unit/expressions/test_jinja_expression.py | 2 +- mistral/tests/unit/expressions/test_yaql_expression.py | 2 +- mistral/tests/unit/hacking/test_checks.py | 2 +- mistral/tests/unit/notifiers/test_notifier_servers.py | 2 +- mistral/tests/unit/notifiers/test_notify.py | 2 +- mistral/tests/unit/policies/test_actions.py | 2 +- mistral/tests/unit/policies/test_workflows.py | 2 +- mistral/tests/unit/rpc/kombu/fake_kombu.py | 2 +- mistral/tests/unit/rpc/kombu/test_kombu_client.py | 2 +- mistral/tests/unit/rpc/kombu/test_kombu_listener.py | 2 +- mistral/tests/unit/rpc/kombu/test_kombu_server.py | 2 +- mistral/tests/unit/scheduler/test_default_scheduler.py | 2 +- mistral/tests/unit/services/test_event_engine.py | 2 +- mistral/tests/unit/services/test_legacy_scheduler.py | 2 +- mistral/tests/unit/services/test_trigger_service.py | 2 +- mistral/tests/unit/test_coordination.py | 3 ++- mistral/tests/unit/workflow/test_direct_workflow.py | 2 +- test-requirements.txt | 1 - 69 files changed, 83 insertions(+), 69 deletions(-) diff --git a/mistral/tests/unit/actions/test_javascript_action.py b/mistral/tests/unit/actions/test_javascript_action.py index c1e794998..3cc652211 100644 --- a/mistral/tests/unit/actions/test_javascript_action.py +++ b/mistral/tests/unit/actions/test_javascript_action.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from mistral.actions import std_actions as std from mistral.tests.unit import base diff --git a/mistral/tests/unit/actions/test_std_echo_action.py b/mistral/tests/unit/actions/test_std_echo_action.py index 5ae2d4b1e..3ec527910 100644 --- a/mistral/tests/unit/actions/test_std_echo_action.py +++ b/mistral/tests/unit/actions/test_std_echo_action.py @@ -14,7 +14,7 @@ from mistral.actions import std_actions as std from mistral.tests.unit import base -import mock +from unittest import mock class EchoActionTest(base.BaseTest): diff --git a/mistral/tests/unit/actions/test_std_email_action.py b/mistral/tests/unit/actions/test_std_email_action.py index 2644e4028..ca71d7ff8 100644 --- a/mistral/tests/unit/actions/test_std_email_action.py +++ b/mistral/tests/unit/actions/test_std_email_action.py @@ -17,7 +17,8 @@ import base64 from email.header import decode_header from email import parser -import mock +from unittest import mock + import six import testtools diff --git a/mistral/tests/unit/actions/test_std_fail_action.py b/mistral/tests/unit/actions/test_std_fail_action.py index be4e50650..69ff1c1a8 100644 --- a/mistral/tests/unit/actions/test_std_fail_action.py +++ b/mistral/tests/unit/actions/test_std_fail_action.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from mistral.actions import std_actions as std from mistral import exceptions as exc diff --git a/mistral/tests/unit/actions/test_std_http_action.py b/mistral/tests/unit/actions/test_std_http_action.py index 2a1d6bc75..938223466 100644 --- a/mistral/tests/unit/actions/test_std_http_action.py +++ b/mistral/tests/unit/actions/test_std_http_action.py @@ -13,8 +13,8 @@ # limitations under the License. import json +from unittest import mock -import mock import requests from mistral.actions import std_actions as std diff --git a/mistral/tests/unit/actions/test_std_mistral_http_action.py b/mistral/tests/unit/actions/test_std_mistral_http_action.py index 75b126f3f..c24cc5d6e 100644 --- a/mistral/tests/unit/actions/test_std_mistral_http_action.py +++ b/mistral/tests/unit/actions/test_std_mistral_http_action.py @@ -11,8 +11,8 @@ # limitations under the License. import json +from unittest import mock -import mock import requests from mistral.actions import std_actions as std diff --git a/mistral/tests/unit/actions/test_std_ssh_action.py b/mistral/tests/unit/actions/test_std_ssh_action.py index 900a3ab4b..c822c3e0e 100644 --- a/mistral/tests/unit/actions/test_std_ssh_action.py +++ b/mistral/tests/unit/actions/test_std_ssh_action.py @@ -13,7 +13,7 @@ # under the License. import json -import mock +from unittest import mock from mistral.actions import std_actions as std from mistral import exceptions as exc diff --git a/mistral/tests/unit/actions/test_std_test_dict_action.py b/mistral/tests/unit/actions/test_std_test_dict_action.py index b572b90e8..0adf4dfcc 100644 --- a/mistral/tests/unit/actions/test_std_test_dict_action.py +++ b/mistral/tests/unit/actions/test_std_test_dict_action.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from mistral.actions import std_actions as std from mistral.tests.unit import base diff --git a/mistral/tests/unit/api/base.py b/mistral/tests/unit/api/base.py index 8e645d2b5..4c41e177e 100644 --- a/mistral/tests/unit/api/base.py +++ b/mistral/tests/unit/api/base.py @@ -12,9 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock import pecan import pecan.testing +from unittest import mock from webtest import app as webtest_app from mistral.api import app as pecan_app diff --git a/mistral/tests/unit/api/test_service.py b/mistral/tests/unit/api/test_service.py index b4634dd8b..b20df23f0 100644 --- a/mistral/tests/unit/api/test_service.py +++ b/mistral/tests/unit/api/test_service.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_concurrency import processutils from oslo_config import cfg diff --git a/mistral/tests/unit/api/v2/test_action_executions.py b/mistral/tests/unit/api/v2/test_action_executions.py index 6f56d5f8e..a069b52ad 100644 --- a/mistral/tests/unit/api/v2/test_action_executions.py +++ b/mistral/tests/unit/api/v2/test_action_executions.py @@ -16,8 +16,8 @@ import copy import datetime import json +from unittest import mock -import mock from oslo_config import cfg import oslo_messaging from oslo_messaging import exceptions as oslo_exc diff --git a/mistral/tests/unit/api/v2/test_actions.py b/mistral/tests/unit/api/v2/test_actions.py index d82e43853..7dec42b51 100644 --- a/mistral/tests/unit/api/v2/test_actions.py +++ b/mistral/tests/unit/api/v2/test_actions.py @@ -13,8 +13,8 @@ # limitations under the License. import copy +from unittest import mock -import mock import sqlalchemy as sa from mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/api/v2/test_cron_triggers.py b/mistral/tests/unit/api/v2/test_cron_triggers.py index abc3a02ae..1053e0008 100644 --- a/mistral/tests/unit/api/v2/test_cron_triggers.py +++ b/mistral/tests/unit/api/v2/test_cron_triggers.py @@ -14,8 +14,8 @@ import copy import json +from unittest import mock -import mock import sqlalchemy as sa from mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/api/v2/test_environment.py b/mistral/tests/unit/api/v2/test_environment.py index 94051e058..90fa4cab3 100644 --- a/mistral/tests/unit/api/v2/test_environment.py +++ b/mistral/tests/unit/api/v2/test_environment.py @@ -15,8 +15,8 @@ import copy import datetime import json +from unittest import mock -import mock import six import sqlalchemy as sa diff --git a/mistral/tests/unit/api/v2/test_event_trigger.py b/mistral/tests/unit/api/v2/test_event_trigger.py index dbdf57956..12e1e7e65 100644 --- a/mistral/tests/unit/api/v2/test_event_trigger.py +++ b/mistral/tests/unit/api/v2/test_event_trigger.py @@ -14,8 +14,8 @@ import copy import json +from unittest import mock -import mock import sqlalchemy as sa from mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/api/v2/test_executions.py b/mistral/tests/unit/api/v2/test_executions.py index 06faa1c07..e5b08ecf6 100644 --- a/mistral/tests/unit/api/v2/test_executions.py +++ b/mistral/tests/unit/api/v2/test_executions.py @@ -19,8 +19,8 @@ import copy import datetime import json +from unittest import mock -import mock from oslo_config import cfg import oslo_messaging from oslo_utils import uuidutils diff --git a/mistral/tests/unit/api/v2/test_keycloak_auth.py b/mistral/tests/unit/api/v2/test_keycloak_auth.py index 2224c69d3..a7c006310 100644 --- a/mistral/tests/unit/api/v2/test_keycloak_auth.py +++ b/mistral/tests/unit/api/v2/test_keycloak_auth.py @@ -14,11 +14,12 @@ import datetime import json -import mock import pecan import pecan.testing import requests import requests_mock +from unittest import mock + import webob from mistral.api import app as pecan_app diff --git a/mistral/tests/unit/api/v2/test_members.py b/mistral/tests/unit/api/v2/test_members.py index 3abc379e6..75eb31654 100644 --- a/mistral/tests/unit/api/v2/test_members.py +++ b/mistral/tests/unit/api/v2/test_members.py @@ -13,8 +13,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_config import cfg from oslo_utils import uuidutils import sqlalchemy as sa diff --git a/mistral/tests/unit/api/v2/test_services.py b/mistral/tests/unit/api/v2/test_services.py index a86c5a005..bdc255a25 100644 --- a/mistral/tests/unit/api/v2/test_services.py +++ b/mistral/tests/unit/api/v2/test_services.py @@ -12,7 +12,8 @@ # 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 import tooz.coordination from webtest import app as webtest_app diff --git a/mistral/tests/unit/api/v2/test_tasks.py b/mistral/tests/unit/api/v2/test_tasks.py index a14096184..0835f8776 100644 --- a/mistral/tests/unit/api/v2/test_tasks.py +++ b/mistral/tests/unit/api/v2/test_tasks.py @@ -17,8 +17,8 @@ import copy import datetime import json +from unittest import mock -import mock import sqlalchemy as sa from mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/api/v2/test_workbooks.py b/mistral/tests/unit/api/v2/test_workbooks.py index d9fff86fd..8ce1822ab 100644 --- a/mistral/tests/unit/api/v2/test_workbooks.py +++ b/mistral/tests/unit/api/v2/test_workbooks.py @@ -14,8 +14,8 @@ # limitations under the License. import copy +from unittest import mock -import mock import sqlalchemy as sa from mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/api/v2/test_workflows.py b/mistral/tests/unit/api/v2/test_workflows.py index 06a417aaf..e15491554 100644 --- a/mistral/tests/unit/api/v2/test_workflows.py +++ b/mistral/tests/unit/api/v2/test_workflows.py @@ -15,9 +15,9 @@ import copy import datetime +from unittest import mock import json -import mock import sqlalchemy as sa import yaml diff --git a/mistral/tests/unit/base.py b/mistral/tests/unit/base.py index b5361bf8f..681d5f5f1 100644 --- a/mistral/tests/unit/base.py +++ b/mistral/tests/unit/base.py @@ -18,8 +18,8 @@ import json import pkg_resources as pkg import sys import time +from unittest import mock -import mock from oslo_config import cfg from oslo_log import log as logging from oslotest import base diff --git a/mistral/tests/unit/engine/test_action_caching.py b/mistral/tests/unit/engine/test_action_caching.py index 8a1374b04..7af2a8587 100644 --- a/mistral/tests/unit/engine/test_action_caching.py +++ b/mistral/tests/unit/engine/test_action_caching.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock import cachetools from oslo_config import cfg diff --git a/mistral/tests/unit/engine/test_action_context.py b/mistral/tests/unit/engine/test_action_context.py index 63ad1ec3b..5dc5751b6 100644 --- a/mistral/tests/unit/engine/test_action_context.py +++ b/mistral/tests/unit/engine/test_action_context.py @@ -10,7 +10,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from mistral.db.v2 import api as db_api from mistral.services import workflows as wf_service diff --git a/mistral/tests/unit/engine/test_action_defaults.py b/mistral/tests/unit/engine/test_action_defaults.py index b64c2ad94..81203acc6 100644 --- a/mistral/tests/unit/engine/test_action_defaults.py +++ b/mistral/tests/unit/engine/test_action_defaults.py @@ -12,7 +12,8 @@ # 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 import requests diff --git a/mistral/tests/unit/engine/test_action_heartbeat_checker.py b/mistral/tests/unit/engine/test_action_heartbeat_checker.py index cf5316205..3072d7652 100644 --- a/mistral/tests/unit/engine/test_action_heartbeat_checker.py +++ b/mistral/tests/unit/engine/test_action_heartbeat_checker.py @@ -11,7 +11,7 @@ # limitations under the License. import cachetools -import mock +from unittest import mock from oslo_config import cfg diff --git a/mistral/tests/unit/engine/test_action_heartbeat_sender.py b/mistral/tests/unit/engine/test_action_heartbeat_sender.py index 56d316f88..3cbd4597a 100644 --- a/mistral/tests/unit/engine/test_action_heartbeat_sender.py +++ b/mistral/tests/unit/engine/test_action_heartbeat_sender.py @@ -10,7 +10,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 diff --git a/mistral/tests/unit/engine/test_cron_trigger.py b/mistral/tests/unit/engine/test_cron_trigger.py index c2087f53d..ddac373d2 100644 --- a/mistral/tests/unit/engine/test_cron_trigger.py +++ b/mistral/tests/unit/engine/test_cron_trigger.py @@ -12,8 +12,8 @@ # See the License for the specific language governing permissions and # limitations under the License. import datetime +from unittest import mock -import mock from oslo_config import cfg from mistral import context as auth_ctx diff --git a/mistral/tests/unit/engine/test_default_engine.py b/mistral/tests/unit/engine/test_default_engine.py index 6522907c3..e658287a7 100644 --- a/mistral/tests/unit/engine/test_default_engine.py +++ b/mistral/tests/unit/engine/test_default_engine.py @@ -14,8 +14,8 @@ # limitations under the License. import datetime +from unittest import mock -import mock from oslo_config import cfg from oslo_messaging.rpc import client as rpc_client from oslo_utils import uuidutils diff --git a/mistral/tests/unit/engine/test_direct_workflow_rerun.py b/mistral/tests/unit/engine/test_direct_workflow_rerun.py index 54f9a0021..537bd1617 100644 --- a/mistral/tests/unit/engine/test_direct_workflow_rerun.py +++ b/mistral/tests/unit/engine/test_direct_workflow_rerun.py @@ -12,7 +12,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 import testtools diff --git a/mistral/tests/unit/engine/test_direct_workflow_rerun_cancelled.py b/mistral/tests/unit/engine/test_direct_workflow_rerun_cancelled.py index 112282eff..125feabe4 100644 --- a/mistral/tests/unit/engine/test_direct_workflow_rerun_cancelled.py +++ b/mistral/tests/unit/engine/test_direct_workflow_rerun_cancelled.py @@ -12,7 +12,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 diff --git a/mistral/tests/unit/engine/test_disabled_yaql_conversion.py b/mistral/tests/unit/engine/test_disabled_yaql_conversion.py index 493c1567d..098625951 100644 --- a/mistral/tests/unit/engine/test_disabled_yaql_conversion.py +++ b/mistral/tests/unit/engine/test_disabled_yaql_conversion.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 mistral.db.v2 import api as db_api from mistral.engine import engine_server diff --git a/mistral/tests/unit/engine/test_environment.py b/mistral/tests/unit/engine/test_environment.py index e384172ba..63536cc6d 100644 --- a/mistral/tests/unit/engine/test_environment.py +++ b/mistral/tests/unit/engine/test_environment.py @@ -12,7 +12,8 @@ # 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 mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/engine/test_error_handling.py b/mistral/tests/unit/engine/test_error_handling.py index cd14ba707..8c126a0d9 100644 --- a/mistral/tests/unit/engine/test_error_handling.py +++ b/mistral/tests/unit/engine/test_error_handling.py @@ -12,7 +12,8 @@ # 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 oslo_db import exception as db_exc diff --git a/mistral/tests/unit/engine/test_javascript_action.py b/mistral/tests/unit/engine/test_javascript_action.py index d5501c5a4..e9aa57016 100644 --- a/mistral/tests/unit/engine/test_javascript_action.py +++ b/mistral/tests/unit/engine/test_javascript_action.py @@ -12,7 +12,8 @@ # 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 oslo_utils import importutils import testtools diff --git a/mistral/tests/unit/engine/test_policies.py b/mistral/tests/unit/engine/test_policies.py index e8c25f931..32a8b509a 100644 --- a/mistral/tests/unit/engine/test_policies.py +++ b/mistral/tests/unit/engine/test_policies.py @@ -13,7 +13,8 @@ # limitations under the License. from eventlet import timeout -import mock +from unittest import mock + from oslo_config import cfg import requests diff --git a/mistral/tests/unit/engine/test_profiler.py b/mistral/tests/unit/engine/test_profiler.py index 417595d89..1563b6ce3 100644 --- a/mistral/tests/unit/engine/test_profiler.py +++ b/mistral/tests/unit/engine/test_profiler.py @@ -12,7 +12,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 import osprofiler diff --git a/mistral/tests/unit/engine/test_reverse_workflow_rerun.py b/mistral/tests/unit/engine/test_reverse_workflow_rerun.py index 88e84a9b3..23943320a 100644 --- a/mistral/tests/unit/engine/test_reverse_workflow_rerun.py +++ b/mistral/tests/unit/engine/test_reverse_workflow_rerun.py @@ -12,7 +12,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 diff --git a/mistral/tests/unit/engine/test_reverse_workflow_rerun_cancelled.py b/mistral/tests/unit/engine/test_reverse_workflow_rerun_cancelled.py index 50b9cbcb3..1c2cdbd1f 100644 --- a/mistral/tests/unit/engine/test_reverse_workflow_rerun_cancelled.py +++ b/mistral/tests/unit/engine/test_reverse_workflow_rerun_cancelled.py @@ -12,7 +12,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 diff --git a/mistral/tests/unit/engine/test_run_action.py b/mistral/tests/unit/engine/test_run_action.py index ca5b80f9c..bcbd10d09 100644 --- a/mistral/tests/unit/engine/test_run_action.py +++ b/mistral/tests/unit/engine/test_run_action.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_config import cfg from mistral.actions import std_actions diff --git a/mistral/tests/unit/engine/test_safe_rerun.py b/mistral/tests/unit/engine/test_safe_rerun.py index b1da423b3..4d1e7b477 100644 --- a/mistral/tests/unit/engine/test_safe_rerun.py +++ b/mistral/tests/unit/engine/test_safe_rerun.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from mistral.db.v2 import api as db_api from mistral.executors import default_executor as d_exe diff --git a/mistral/tests/unit/engine/test_state_info.py b/mistral/tests/unit/engine/test_state_info.py index a414ae673..523ac6ca1 100644 --- a/mistral/tests/unit/engine/test_state_info.py +++ b/mistral/tests/unit/engine/test_state_info.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 diff --git a/mistral/tests/unit/engine/test_subworkflows.py b/mistral/tests/unit/engine/test_subworkflows.py index 871e058e3..0060b0380 100644 --- a/mistral/tests/unit/engine/test_subworkflows.py +++ b/mistral/tests/unit/engine/test_subworkflows.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_config import cfg from mistral.actions import std_actions diff --git a/mistral/tests/unit/engine/test_task_cancel.py b/mistral/tests/unit/engine/test_task_cancel.py index d5ca618e7..d371e5f4f 100644 --- a/mistral/tests/unit/engine/test_task_cancel.py +++ b/mistral/tests/unit/engine/test_task_cancel.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 mistral.actions import std_actions from mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/engine/test_task_defaults.py b/mistral/tests/unit/engine/test_task_defaults.py index 694060e26..faaebfddf 100644 --- a/mistral/tests/unit/engine/test_task_defaults.py +++ b/mistral/tests/unit/engine/test_task_defaults.py @@ -13,7 +13,8 @@ # limitations under the License. import datetime as dt -import mock +from unittest import mock + from oslo_config import cfg import requests diff --git a/mistral/tests/unit/engine/test_task_publish.py b/mistral/tests/unit/engine/test_task_publish.py index c160a0517..be671a93a 100644 --- a/mistral/tests/unit/engine/test_task_publish.py +++ b/mistral/tests/unit/engine/test_task_publish.py @@ -12,7 +12,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 diff --git a/mistral/tests/unit/engine/test_with_items.py b/mistral/tests/unit/engine/test_with_items.py index b8c819b5b..323a1d684 100644 --- a/mistral/tests/unit/engine/test_with_items.py +++ b/mistral/tests/unit/engine/test_with_items.py @@ -13,7 +13,8 @@ # limitations under the License. import copy -import mock +from unittest import mock + from oslo_config import cfg from mistral.actions import std_actions diff --git a/mistral/tests/unit/engine/test_workflow_resume.py b/mistral/tests/unit/engine/test_workflow_resume.py index 1d0ba2d89..8a9d6b948 100644 --- a/mistral/tests/unit/engine/test_workflow_resume.py +++ b/mistral/tests/unit/engine/test_workflow_resume.py @@ -12,7 +12,8 @@ # 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 mistral.db.v2 import api as db_api diff --git a/mistral/tests/unit/engine/test_yaql_functions.py b/mistral/tests/unit/engine/test_yaql_functions.py index 21a72b022..04b8bc9a8 100644 --- a/mistral/tests/unit/engine/test_yaql_functions.py +++ b/mistral/tests/unit/engine/test_yaql_functions.py @@ -12,7 +12,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 diff --git a/mistral/tests/unit/executors/test_local_executor.py b/mistral/tests/unit/executors/test_local_executor.py index 47e3d619f..89f585c2c 100644 --- a/mistral/tests/unit/executors/test_local_executor.py +++ b/mistral/tests/unit/executors/test_local_executor.py @@ -12,7 +12,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 oslo_log import log as logging diff --git a/mistral/tests/unit/expressions/test_jinja_expression.py b/mistral/tests/unit/expressions/test_jinja_expression.py index 81c8552d7..1c3815b92 100644 --- a/mistral/tests/unit/expressions/test_jinja_expression.py +++ b/mistral/tests/unit/expressions/test_jinja_expression.py @@ -13,7 +13,7 @@ # limitations under the License. import datetime -import mock +from unittest import mock from mistral.db.v2.sqlalchemy import api as db_api from mistral import exceptions as exc diff --git a/mistral/tests/unit/expressions/test_yaql_expression.py b/mistral/tests/unit/expressions/test_yaql_expression.py index 4b8739912..80c325e15 100644 --- a/mistral/tests/unit/expressions/test_yaql_expression.py +++ b/mistral/tests/unit/expressions/test_yaql_expression.py @@ -17,9 +17,9 @@ import datetime import json import sys +from unittest import mock import warnings -import mock from mistral.config import cfg from mistral import exceptions as exc diff --git a/mistral/tests/unit/hacking/test_checks.py b/mistral/tests/unit/hacking/test_checks.py index 46eea16c9..f05edf0b6 100644 --- a/mistral/tests/unit/hacking/test_checks.py +++ b/mistral/tests/unit/hacking/test_checks.py @@ -11,8 +11,8 @@ # under the License. import textwrap +from unittest import mock -import mock import pycodestyle from mistral.hacking import checks diff --git a/mistral/tests/unit/notifiers/test_notifier_servers.py b/mistral/tests/unit/notifiers/test_notifier_servers.py index 860c1fba2..bf9d68ebd 100644 --- a/mistral/tests/unit/notifiers/test_notifier_servers.py +++ b/mistral/tests/unit/notifiers/test_notifier_servers.py @@ -12,7 +12,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 stevedore import exception as sd_exc diff --git a/mistral/tests/unit/notifiers/test_notify.py b/mistral/tests/unit/notifiers/test_notify.py index dacfe44e9..1ca2402af 100644 --- a/mistral/tests/unit/notifiers/test_notify.py +++ b/mistral/tests/unit/notifiers/test_notify.py @@ -13,7 +13,7 @@ # limitations under the License. import json -import mock +from unittest import mock from oslo_config import cfg diff --git a/mistral/tests/unit/policies/test_actions.py b/mistral/tests/unit/policies/test_actions.py index 53fff3f85..3f19a128b 100644 --- a/mistral/tests/unit/policies/test_actions.py +++ b/mistral/tests/unit/policies/test_actions.py @@ -13,7 +13,7 @@ # under the License. -import mock +from unittest import mock from mistral.db.v2 import api as db_api from mistral.db.v2.sqlalchemy import models diff --git a/mistral/tests/unit/policies/test_workflows.py b/mistral/tests/unit/policies/test_workflows.py index c47bdc8f3..2bfa094fc 100644 --- a/mistral/tests/unit/policies/test_workflows.py +++ b/mistral/tests/unit/policies/test_workflows.py @@ -15,8 +15,8 @@ import datetime +from unittest import mock -import mock from mistral.db.v2 import api as db_api from mistral.db.v2.sqlalchemy import models diff --git a/mistral/tests/unit/rpc/kombu/fake_kombu.py b/mistral/tests/unit/rpc/kombu/fake_kombu.py index 00c470899..605116157 100644 --- a/mistral/tests/unit/rpc/kombu/fake_kombu.py +++ b/mistral/tests/unit/rpc/kombu/fake_kombu.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. from kombu import mixins as mx -import mock +from unittest import mock # Hack for making tests works with kombu listener diff --git a/mistral/tests/unit/rpc/kombu/test_kombu_client.py b/mistral/tests/unit/rpc/kombu/test_kombu_client.py index 8576285ad..054aeeca1 100644 --- a/mistral/tests/unit/rpc/kombu/test_kombu_client.py +++ b/mistral/tests/unit/rpc/kombu/test_kombu_client.py @@ -16,8 +16,8 @@ from mistral import exceptions as exc from mistral.tests.unit.rpc.kombu import base from mistral.tests.unit.rpc.kombu import fake_kombu +from unittest import mock -import mock from six import moves with mock.patch.dict('sys.modules', kombu=fake_kombu): diff --git a/mistral/tests/unit/rpc/kombu/test_kombu_listener.py b/mistral/tests/unit/rpc/kombu/test_kombu_listener.py index c8d8d06db..448e33775 100644 --- a/mistral/tests/unit/rpc/kombu/test_kombu_listener.py +++ b/mistral/tests/unit/rpc/kombu/test_kombu_listener.py @@ -17,8 +17,8 @@ from mistral import exceptions as exc from mistral.tests.unit.rpc.kombu import base from mistral.tests.unit.rpc.kombu import fake_kombu from mistral_lib import utils +from unittest import mock -import mock from six import moves with mock.patch.dict('sys.modules', kombu=fake_kombu): diff --git a/mistral/tests/unit/rpc/kombu/test_kombu_server.py b/mistral/tests/unit/rpc/kombu/test_kombu_server.py index 508132e18..7f997ceaa 100644 --- a/mistral/tests/unit/rpc/kombu/test_kombu_server.py +++ b/mistral/tests/unit/rpc/kombu/test_kombu_server.py @@ -18,8 +18,8 @@ from mistral import context from mistral import exceptions as exc from mistral.tests.unit.rpc.kombu import base from mistral.tests.unit.rpc.kombu import fake_kombu +from unittest import mock -import mock import socket from stevedore import driver diff --git a/mistral/tests/unit/scheduler/test_default_scheduler.py b/mistral/tests/unit/scheduler/test_default_scheduler.py index 77bd9ef49..53ab398c6 100644 --- a/mistral/tests/unit/scheduler/test_default_scheduler.py +++ b/mistral/tests/unit/scheduler/test_default_scheduler.py @@ -15,9 +15,9 @@ from eventlet import event from eventlet import semaphore from eventlet import timeout +from unittest import mock import datetime -import mock from oslo_config import cfg diff --git a/mistral/tests/unit/services/test_event_engine.py b/mistral/tests/unit/services/test_event_engine.py index ba1ebc72d..d051747dd 100644 --- a/mistral/tests/unit/services/test_event_engine.py +++ b/mistral/tests/unit/services/test_event_engine.py @@ -15,8 +15,8 @@ import copy import time +from unittest import mock -import mock from oslo_config import cfg from mistral import context as auth_context diff --git a/mistral/tests/unit/services/test_legacy_scheduler.py b/mistral/tests/unit/services/test_legacy_scheduler.py index 69cd7fc4b..47f54a9e4 100644 --- a/mistral/tests/unit/services/test_legacy_scheduler.py +++ b/mistral/tests/unit/services/test_legacy_scheduler.py @@ -15,7 +15,7 @@ import datetime import eventlet -import mock +from unittest import mock from eventlet import queue from eventlet import timeout diff --git a/mistral/tests/unit/services/test_trigger_service.py b/mistral/tests/unit/services/test_trigger_service.py index 202d62297..f7c6082f1 100644 --- a/mistral/tests/unit/services/test_trigger_service.py +++ b/mistral/tests/unit/services/test_trigger_service.py @@ -14,7 +14,7 @@ import datetime import eventlet -import mock +from unittest import mock from oslo_config import cfg diff --git a/mistral/tests/unit/test_coordination.py b/mistral/tests/unit/test_coordination.py index 1ba5f52ef..0b1e1c9a1 100644 --- a/mistral/tests/unit/test_coordination.py +++ b/mistral/tests/unit/test_coordination.py @@ -12,7 +12,8 @@ # 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 import six diff --git a/mistral/tests/unit/workflow/test_direct_workflow.py b/mistral/tests/unit/workflow/test_direct_workflow.py index 3f68008f3..9c34f29e5 100644 --- a/mistral/tests/unit/workflow/test_direct_workflow.py +++ b/mistral/tests/unit/workflow/test_direct_workflow.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from mistral.db.v2 import api as db_api from mistral.db.v2.sqlalchemy import models diff --git a/test-requirements.txt b/test-requirements.txt index eb5002aa7..f7d71d4e1 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -7,7 +7,6 @@ coverage!=4.4,>=4.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0 Pygments>=2.2.0 # BSD license fixtures>=3.0.0 # Apache-2.0/BSD -mock>=2.0.0 # BSD nose>=1.3.7 # LGPL oslotest>=3.2.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0