Remove the dependency on the "mock" package

Now that we are python3 only, we should move to using the built
in version of mock that supports all of our testing needs and
remove the dependency on the "mock" package.

This patch moves all references to "import mock" to
"from unittest import mock". It also cleans up some new line
inconsistency.

Change-Id: I72520a2ca010c2c27315d9dff839a4f9d7540b6b
This commit is contained in:
Michael Johnson 2020-02-17 14:23:29 -08:00
parent bb0efa2a5d
commit 49036845c1
107 changed files with 111 additions and 141 deletions

View File

@ -12,9 +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 fixtures
import mock
# Borrowed from neutron

View File

@ -15,9 +15,9 @@
import os
import stat
import subprocess
from unittest import mock
import flask
import mock
from oslo_utils import uuidutils

View File

@ -18,9 +18,9 @@ import random
import socket
import stat
import subprocess
from unittest import mock
import fixtures
import mock
from oslo_config import fixture as oslo_fixture
from oslo_serialization import jsonutils
from oslo_utils import uuidutils

View File

@ -12,7 +12,8 @@
# 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_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -13,8 +13,8 @@
# under the License.
import datetime
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

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 oslo_config import cfg
from oslo_config import fixture as oslo_fixture

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 oslo_utils import uuidutils

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 oslo_config import cfg
from oslo_config import fixture as oslo_fixture

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 oslo_utils import uuidutils

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 oslo_config import cfg
from oslo_config import fixture as oslo_fixture

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 oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -15,8 +15,8 @@
import copy
import random
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -14,8 +14,8 @@
import copy
import random
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from octavia_lib.api.drivers import data_models as driver_dm
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

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 oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -13,7 +13,7 @@
# under the License.
import mock
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -13,8 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import random
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -15,8 +15,8 @@
import copy
import datetime
import random
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_db import exception as db_exception

View File

@ -11,10 +11,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.
import random
from unittest import mock
import mock
from oslo_utils import uuidutils
from octavia.amphorae.backends.agent import api_server

View File

@ -11,8 +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 octavia.amphorae.backends.agent.api_server import haproxy_compatibility
from octavia.common import constants

View File

@ -11,11 +11,10 @@
# 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 subprocess
from unittest import mock
import flask
import mock
from octavia.amphorae.backends.agent.api_server import keepalived
import octavia.tests.unit.base as base

View File

@ -11,8 +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 oslo_utils import uuidutils

View File

@ -11,10 +11,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.
import subprocess
from unittest import mock
import mock
from oslo_utils import uuidutils
from octavia.amphorae.backends.agent.api_server import loadbalancer

View File

@ -11,12 +11,11 @@
# 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 ipaddress
import os
import shutil
from unittest import mock
import mock
from oslo_config import fixture as oslo_fixture
from octavia.amphorae.backends.agent.api_server import osutils

View File

@ -11,11 +11,10 @@
# 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 os
import subprocess
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from werkzeug import exceptions as wz_exceptions

View File

@ -11,11 +11,10 @@
# 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 os
import subprocess
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -11,12 +11,11 @@
# 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 binascii
import random
import socket
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -11,10 +11,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.
import socket
from unittest import mock
import mock
import six
from octavia.amphorae.backends.utils import haproxy_query as query

View File

@ -9,8 +9,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.
from unittest import mock
import mock
from oslo_utils import uuidutils
from octavia.amphorae.backends.agent.api_server import util

View File

@ -12,10 +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.
import hashlib
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -12,10 +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.
import hashlib
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -12,12 +12,11 @@
# 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 binascii
import random
import socket
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -12,10 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
#
import copy
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
import mock
from oslo_utils import uuidutils
from octavia.amphorae.drivers.keepalived import vrrp_rest_driver

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_utils import uuidutils
from octavia.amphorae.drivers.noop_driver import driver

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 octavia_lib.api.drivers import data_models as driver_dm
from octavia_lib.api.drivers import exceptions

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 octavia_lib.api.drivers import data_models as driver_dm
from octavia_lib.api.drivers import exceptions

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 octavia_lib.common import constants as lib_consts
from oslo_utils import uuidutils

View File

@ -11,10 +11,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 errno
import mock
from unittest import mock
from oslo_config import cfg
from oslo_serialization import jsonutils

View File

@ -11,10 +11,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.
import copy
from unittest import mock
import mock
from mock import call
from octavia.api.drivers.driver_agent import driver_updater

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 octavia.api.drivers import driver_factory
from octavia.common import exceptions

View File

@ -26,7 +26,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
import octavia_lib.api.drivers.driver_lib as lib_driver_lib

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 octavia.api.drivers.noop_driver import agent
import octavia.tests.unit.base as base

View File

@ -11,10 +11,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 copy
import mock
from unittest import mock
from octavia_lib.api.drivers import data_models as driver_dm
from octavia_lib.api.drivers import exceptions as lib_exceptions

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 oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -11,8 +11,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 fixtures
import mock
from oslo_config import cfg
import oslo_messaging as messaging
from oslo_messaging import conffixture as messaging_conffixture

View File

@ -11,9 +11,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
from barbicanclient.v1 import acls
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -11,10 +11,10 @@
# 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
from barbicanclient.v1 import containers
from barbicanclient.v1 import secrets
import mock
import six
import octavia.certificates.common.barbican as barbican_common

View File

@ -11,13 +11,13 @@
# 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
from cryptography.hazmat import backends
from cryptography.hazmat.primitives.asymmetric import rsa
from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives import serialization
from cryptography import x509
import mock
import octavia.tests.unit.base as base

View File

@ -11,11 +11,10 @@
# 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 uuid
from barbicanclient.v1 import secrets
import mock
from OpenSSL import crypto
import octavia.certificates.common.barbican as barbican_common

View File

@ -11,10 +11,10 @@
# 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
from barbicanclient.v1 import containers
from barbicanclient.v1 import secrets
import mock
from oslo_utils import uuidutils
import six

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 octavia.certificates.manager import castellan_mgr
from octavia.common import exceptions

View File

@ -14,8 +14,8 @@
import os
import stat
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -10,8 +10,7 @@
# License for the specific language governing permissions and limitations
# under the License.
import ssl
import mock
from unittest import mock
from octavia.cmd import agent
from octavia.tests.unit import base

View File

@ -11,10 +11,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.
import signal
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

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 octavia.cmd import haproxy_vrrp_check
from octavia.tests.unit import base

View File

@ -11,10 +11,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 signal
import mock
from unittest import mock
from octavia.cmd import health_manager
from octavia.tests.unit import base

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 octavia.cmd import house_keeping
from octavia.tests.unit import base

View File

@ -12,10 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
#
import concurrent.futures
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from taskflow import engines as tf_engines

View File

@ -9,10 +9,10 @@
# 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 cinderclient.v3
import glanceclient.v2
import mock
import neutronclient.v2_0
import novaclient.v2
from oslo_config import cfg

View File

@ -11,10 +11,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.
import random
from unittest import mock
import mock
from oslo_utils import uuidutils
from octavia.common import constants

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -13,9 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
import datetime
from unittest import mock
from cryptography import x509
import mock
from octavia.common import data_models
import octavia.common.exceptions as exceptions

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from novaclient import exceptions as nova_exceptions
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -14,8 +14,8 @@
import random
import time
from unittest import mock
import mock
from oslo_config import cfg
from oslo_utils import uuidutils
import six

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 octavia.controller.healthmanager.health_drivers import update_logging
from octavia.tests.unit import base

View File

@ -11,10 +11,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 threading
import mock
from unittest import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture

View File

@ -11,10 +11,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.
import datetime
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
import oslo_messaging as messaging

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
import oslo_messaging as messaging

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from oslo_utils import uuidutils

View File

@ -11,8 +11,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.
from unittest import mock
import mock
from oslo_utils import uuidutils
from octavia.common import constants

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from taskflow.patterns import linear_flow as flow

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
#
import mock
from unittest import mock
from taskflow.patterns import linear_flow as flow
from octavia.common import constants

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture
from taskflow.patterns import linear_flow as flow

View File

@ -12,8 +12,8 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
import mock
from taskflow.patterns import linear_flow as flow
from octavia.common import constants

View File

@ -12,9 +12,9 @@
# License for the specific language governing permissions and limitations
# under the License.
#
from unittest import mock
from cryptography import fernet
import mock
from oslo_config import cfg
from oslo_config import fixture as oslo_fixture