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 <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-04-18 11:54:27 -05:00
parent c90472d3e6
commit 545a34c751
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
69 changed files with 83 additions and 69 deletions

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from mistral.actions import std_actions as std from mistral.actions import std_actions as std
from mistral.tests.unit import base from mistral.tests.unit import base

View File

@ -14,7 +14,7 @@
from mistral.actions import std_actions as std from mistral.actions import std_actions as std
from mistral.tests.unit import base from mistral.tests.unit import base
import mock from unittest import mock
class EchoActionTest(base.BaseTest): class EchoActionTest(base.BaseTest):

View File

@ -17,7 +17,8 @@
import base64 import base64
from email.header import decode_header from email.header import decode_header
from email import parser from email import parser
import mock from unittest import mock
import six import six
import testtools import testtools

View File

@ -11,7 +11,7 @@
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from mistral.actions import std_actions as std from mistral.actions import std_actions as std
from mistral import exceptions as exc from mistral import exceptions as exc

View File

@ -13,8 +13,8 @@
# limitations under the License. # limitations under the License.
import json import json
from unittest import mock
import mock
import requests import requests
from mistral.actions import std_actions as std from mistral.actions import std_actions as std

View File

@ -11,8 +11,8 @@
# limitations under the License. # limitations under the License.
import json import json
from unittest import mock
import mock
import requests import requests
from mistral.actions import std_actions as std from mistral.actions import std_actions as std

View File

@ -13,7 +13,7 @@
# under the License. # under the License.
import json import json
import mock from unittest import mock
from mistral.actions import std_actions as std from mistral.actions import std_actions as std
from mistral import exceptions as exc from mistral import exceptions as exc

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from mistral.actions import std_actions as std from mistral.actions import std_actions as std
from mistral.tests.unit import base from mistral.tests.unit import base

View File

@ -12,9 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock
import pecan import pecan
import pecan.testing import pecan.testing
from unittest import mock
from webtest import app as webtest_app from webtest import app as webtest_app
from mistral.api import app as pecan_app from mistral.api import app as pecan_app

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from oslo_concurrency import processutils from oslo_concurrency import processutils
from oslo_config import cfg from oslo_config import cfg

View File

@ -16,8 +16,8 @@
import copy import copy
import datetime import datetime
import json import json
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
import oslo_messaging import oslo_messaging
from oslo_messaging import exceptions as oslo_exc from oslo_messaging import exceptions as oslo_exc

View File

@ -13,8 +13,8 @@
# limitations under the License. # limitations under the License.
import copy import copy
from unittest import mock
import mock
import sqlalchemy as sa import sqlalchemy as sa
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -14,8 +14,8 @@
import copy import copy
import json import json
from unittest import mock
import mock
import sqlalchemy as sa import sqlalchemy as sa
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -15,8 +15,8 @@
import copy import copy
import datetime import datetime
import json import json
from unittest import mock
import mock
import six import six
import sqlalchemy as sa import sqlalchemy as sa

View File

@ -14,8 +14,8 @@
import copy import copy
import json import json
from unittest import mock
import mock
import sqlalchemy as sa import sqlalchemy as sa
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -19,8 +19,8 @@
import copy import copy
import datetime import datetime
import json import json
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
import oslo_messaging import oslo_messaging
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -14,11 +14,12 @@
import datetime import datetime
import json import json
import mock
import pecan import pecan
import pecan.testing import pecan.testing
import requests import requests
import requests_mock import requests_mock
from unittest import mock
import webob import webob
from mistral.api import app as pecan_app from mistral.api import app as pecan_app

View File

@ -13,8 +13,8 @@
# under the License. # under the License.
import copy import copy
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import uuidutils from oslo_utils import uuidutils
import sqlalchemy as sa import sqlalchemy as sa

View File

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import tooz.coordination import tooz.coordination
from webtest import app as webtest_app from webtest import app as webtest_app

View File

@ -17,8 +17,8 @@
import copy import copy
import datetime import datetime
import json import json
from unittest import mock
import mock
import sqlalchemy as sa import sqlalchemy as sa
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -14,8 +14,8 @@
# limitations under the License. # limitations under the License.
import copy import copy
from unittest import mock
import mock
import sqlalchemy as sa import sqlalchemy as sa
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -15,9 +15,9 @@
import copy import copy
import datetime import datetime
from unittest import mock
import json import json
import mock
import sqlalchemy as sa import sqlalchemy as sa
import yaml import yaml

View File

@ -18,8 +18,8 @@ import json
import pkg_resources as pkg import pkg_resources as pkg
import sys import sys
import time import time
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging
from oslotest import base from oslotest import base

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
import cachetools import cachetools
from oslo_config import cfg from oslo_config import cfg

View File

@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api
from mistral.services import workflows as wf_service from mistral.services import workflows as wf_service

View File

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import requests import requests

View File

@ -11,7 +11,7 @@
# limitations under the License. # limitations under the License.
import cachetools import cachetools
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -10,7 +10,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -12,8 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import datetime import datetime
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
from mistral import context as auth_ctx from mistral import context as auth_ctx

View File

@ -14,8 +14,8 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_messaging.rpc import client as rpc_client from oslo_messaging.rpc import client as rpc_client
from oslo_utils import uuidutils from oslo_utils import uuidutils

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import testtools import testtools

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api
from mistral.engine import engine_server from mistral.engine import engine_server

View File

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_db import exception as db_exc from oslo_db import exception as db_exc

View File

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_utils import importutils from oslo_utils import importutils
import testtools import testtools

View File

@ -13,7 +13,8 @@
# limitations under the License. # limitations under the License.
from eventlet import timeout from eventlet import timeout
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import requests import requests

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import osprofiler import osprofiler

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from mistral.actions import std_actions from mistral.actions import std_actions

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api
from mistral.executors import default_executor as d_exe from mistral.executors import default_executor as d_exe

View File

@ -13,7 +13,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -13,7 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from mistral.actions import std_actions from mistral.actions import std_actions

View File

@ -13,8 +13,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock
import testtools import testtools
from unittest import mock
from mistral.actions import std_actions from mistral.actions import std_actions
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -13,7 +13,8 @@
# limitations under the License. # limitations under the License.
import datetime as dt import datetime as dt
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import requests import requests

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -13,7 +13,8 @@
# limitations under the License. # limitations under the License.
import copy import copy
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from mistral.actions import std_actions from mistral.actions import std_actions

View File

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from oslo_log import log as logging from oslo_log import log as logging

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import datetime import datetime
import mock from unittest import mock
from mistral.db.v2.sqlalchemy import api as db_api from mistral.db.v2.sqlalchemy import api as db_api
from mistral import exceptions as exc from mistral import exceptions as exc

View File

@ -17,9 +17,9 @@
import datetime import datetime
import json import json
import sys import sys
from unittest import mock
import warnings import warnings
import mock
from mistral.config import cfg from mistral.config import cfg
from mistral import exceptions as exc from mistral import exceptions as exc

View File

@ -11,8 +11,8 @@
# under the License. # under the License.
import textwrap import textwrap
from unittest import mock
import mock
import pycodestyle import pycodestyle
from mistral.hacking import checks from mistral.hacking import checks

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
from stevedore import exception as sd_exc from stevedore import exception as sd_exc

View File

@ -13,7 +13,7 @@
# limitations under the License. # limitations under the License.
import json import json
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -13,7 +13,7 @@
# under the License. # under the License.
import mock from unittest import mock
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api
from mistral.db.v2.sqlalchemy import models from mistral.db.v2.sqlalchemy import models

View File

@ -15,8 +15,8 @@
import datetime import datetime
from unittest import mock
import mock
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api
from mistral.db.v2.sqlalchemy import models from mistral.db.v2.sqlalchemy import models

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
from kombu import mixins as mx from kombu import mixins as mx
import mock from unittest import mock
# Hack for making tests works with kombu listener # Hack for making tests works with kombu listener

View File

@ -16,8 +16,8 @@
from mistral import exceptions as exc from mistral import exceptions as exc
from mistral.tests.unit.rpc.kombu import base from mistral.tests.unit.rpc.kombu import base
from mistral.tests.unit.rpc.kombu import fake_kombu from mistral.tests.unit.rpc.kombu import fake_kombu
from unittest import mock
import mock
from six import moves from six import moves
with mock.patch.dict('sys.modules', kombu=fake_kombu): with mock.patch.dict('sys.modules', kombu=fake_kombu):

View File

@ -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 base
from mistral.tests.unit.rpc.kombu import fake_kombu from mistral.tests.unit.rpc.kombu import fake_kombu
from mistral_lib import utils from mistral_lib import utils
from unittest import mock
import mock
from six import moves from six import moves
with mock.patch.dict('sys.modules', kombu=fake_kombu): with mock.patch.dict('sys.modules', kombu=fake_kombu):

View File

@ -18,8 +18,8 @@ from mistral import context
from mistral import exceptions as exc from mistral import exceptions as exc
from mistral.tests.unit.rpc.kombu import base from mistral.tests.unit.rpc.kombu import base
from mistral.tests.unit.rpc.kombu import fake_kombu from mistral.tests.unit.rpc.kombu import fake_kombu
from unittest import mock
import mock
import socket import socket
from stevedore import driver from stevedore import driver

View File

@ -15,9 +15,9 @@
from eventlet import event from eventlet import event
from eventlet import semaphore from eventlet import semaphore
from eventlet import timeout from eventlet import timeout
from unittest import mock
import datetime import datetime
import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -15,8 +15,8 @@
import copy import copy
import time import time
from unittest import mock
import mock
from oslo_config import cfg from oslo_config import cfg
from mistral import context as auth_context from mistral import context as auth_context

View File

@ -15,7 +15,7 @@
import datetime import datetime
import eventlet import eventlet
import mock from unittest import mock
from eventlet import queue from eventlet import queue
from eventlet import timeout from eventlet import timeout

View File

@ -14,7 +14,7 @@
import datetime import datetime
import eventlet import eventlet
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg

View File

@ -12,7 +12,8 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from oslo_config import cfg from oslo_config import cfg
import six import six

View File

@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
import mock from unittest import mock
from mistral.db.v2 import api as db_api from mistral.db.v2 import api as db_api
from mistral.db.v2.sqlalchemy import models from mistral.db.v2.sqlalchemy import models

View File

@ -7,7 +7,6 @@ coverage!=4.4,>=4.0 # Apache-2.0
doc8>=0.6.0 # Apache-2.0 doc8>=0.6.0 # Apache-2.0
Pygments>=2.2.0 # BSD license Pygments>=2.2.0 # BSD license
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
nose>=1.3.7 # LGPL nose>=1.3.7 # LGPL
oslotest>=3.2.0 # Apache-2.0 oslotest>=3.2.0 # Apache-2.0
requests-mock>=1.2.0 # Apache-2.0 requests-mock>=1.2.0 # Apache-2.0