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: Ia552f03378bfa2d6612718eeec02da0448d322bc
This commit is contained in:
Hervé Beraud 2020-05-15 18:50:59 +02:00
parent ecce177c03
commit 240fcc9eca
36 changed files with 49 additions and 46 deletions

View File

@ -35,7 +35,6 @@ MarkupSafe==1.0
mccabe==0.2.1
metalsmith==0.13.0
mistral-lib==0.3.0
mock==2.0.0
monotonic==0.6
mox3==0.20.0
msgpack-python==0.4.0

View File

@ -14,7 +14,6 @@
# under the License.
import json
import mock
import os
import random
from six.moves import configparser
@ -22,6 +21,7 @@ import shutil
import string
import sys
import tempfile
from unittest import mock
from oslo_concurrency import processutils

View File

@ -11,7 +11,7 @@
# 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 glanceclient import exc as glance_exceptions
import ironic_inspector_client

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from ironicclient import client as ironicclient

View File

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

View File

@ -12,7 +12,8 @@
# 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
import yaml
from swiftclient import exceptions as swiftexceptions

View File

@ -12,8 +12,7 @@
# 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 heatclient import exc as heatexceptions
from oslo_concurrency import processutils

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
import mock
from unittest import mock
import yaml
from mistral_lib import actions

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import collections
import mock
from unittest import mock
from mistral_lib import actions
from oslo_concurrency.processutils import ProcessExecutionError

View File

@ -13,7 +13,7 @@
# under the License.
#
import mock
from unittest import mock
FAKE_STACK = {

View File

@ -15,10 +15,9 @@
"""Unit tests for image.builder.buildah"""
import copy
import mock
from concurrent import futures
from concurrent.futures import ThreadPoolExecutor as tpe
from unittest import mock
from tripleo_common.image.builder.buildah import BuildahBuilder as bb
from tripleo_common.tests import base

View File

@ -13,8 +13,7 @@
# under the License.
#
import mock
from unittest import mock
from tripleo_common.image.base import BaseImageManager
from tripleo_common.image.exception import ImageSpecificationException

View File

@ -13,7 +13,7 @@
# under the License.
#
import mock
from unittest import mock
from tripleo_common.image.build import ImageBuildManager
from tripleo_common.image.exception import ImageSpecificationException

View File

@ -13,9 +13,8 @@
# under the License.
#
import mock
import subprocess
from unittest import mock
from tripleo_common.image.exception import ImageBuilderException
from tripleo_common.image.image_builder import DibImageBuilder

View File

@ -16,13 +16,13 @@
import hashlib
import io
import json
import mock
import os
import requests
import shutil
import six
from six.moves.urllib.parse import urlparse
import tempfile
from unittest import mock
import zlib
from tripleo_common.image import image_export

View File

@ -16,7 +16,6 @@
import hashlib
import io
import json
import mock
import operator
import os
import requests
@ -24,6 +23,7 @@ from requests_mock.contrib import fixture as rm_fixture
import six
from six.moves.urllib.parse import urlparse
import tempfile
from unittest import mock
import zlib
from oslo_concurrency import processutils

View File

@ -13,12 +13,12 @@
# under the License.
#
import mock
import os
import six
import sys
import tempfile
from unittest import mock
import yaml
from tripleo_common import constants

View File

@ -19,8 +19,7 @@
Test cases for tripleo_common.arch module.
"""
import mock
from unittest import mock
from unittest import TestCase
from tripleo_common import arch

View File

@ -14,8 +14,7 @@
# limitations under the License.
import sys
import mock
from unittest import mock
from tripleo_common.tests import base
from tripleo_common.tests import fake_nova

View File

@ -14,9 +14,10 @@
import fixtures
import os
from unittest.mock import MagicMock
import yaml
from mock import MagicMock
from tripleo_common.tests import base
from tripleo_common.inventories import TripleoInventories

View File

@ -15,10 +15,11 @@
import fixtures
import os
import sys
from unittest.mock import MagicMock
import yaml
from heatclient.exc import HTTPNotFound
from mock import MagicMock
from tripleo_common.inventory import StackOutputs
from tripleo_common.inventory import TripleoInventory

View File

@ -13,7 +13,7 @@
# under the License.
#
import mock
from unittest import mock
from tripleo_common.tests import base
from tripleo_common import update

View File

@ -12,14 +12,15 @@
import datetime
import fixtures
import mock
import os
from unittest import mock
from unittest.mock import patch
from unittest.mock import call
import uuid
import warnings
import yaml
from mock import call
from mock import patch
from tripleo_common import constants
from tripleo_common.tests import base

View File

@ -14,9 +14,9 @@
# limitations under the License.
import collections
from unittest import mock
from glanceclient import exc as exceptions
import mock
import testtools
from tripleo_common.tests import base

View File

@ -14,8 +14,8 @@
# limitations under the License.
import collections
from unittest import mock
import mock
from testtools import matchers
from tripleo_common import exception

View File

@ -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 heatclient import exc as heat_exc
import six

View File

@ -11,7 +11,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
from tripleo_common import exception
from tripleo_common.tests import base

View File

@ -13,7 +13,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import sys
import mock
from unittest import mock
from oslo_utils import uuidutils

View File

@ -14,12 +14,13 @@
# limitations under the License.
import json
import mock
import os
import sys
import yaml
from unittest import mock
import zlib
import yaml
import six
from swiftclient import exceptions as swiftexceptions

View File

@ -17,8 +17,8 @@
import os
from unittest import mock
import mock
from oslo_concurrency import processutils
from tripleo_common.tests import base

View File

@ -13,7 +13,8 @@
# under the License.
#
import mock
from unittest import mock
import yaml
import six

View File

@ -13,10 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.
import tempfile
from unittest import mock
import yaml
from heatclient import exc as heat_exc
import mock
from swiftclient import exceptions as swiftexceptions
from tripleo_common import constants

View File

@ -11,9 +11,10 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from unittest import mock
import yaml
import mock
from swiftclient import exceptions as swiftexceptions
from tripleo_common import constants

View File

@ -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 tripleo_common.tests import base
from tripleo_common.utils import swift as swift_utils

View File

@ -12,8 +12,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import jinja2
import mock
import yaml
from heatclient import exc as heat_exc

View File

@ -12,9 +12,9 @@
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
from unittest import mock
from collections import namedtuple
import mock
import yaml
from tripleo_common.constants import PLAN_NAME_PATTERN