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: I89425273ad2092f5394f20c7cdecde14877b1a01 Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
parent
9f3ebb2130
commit
e5f601a350
@ -6,7 +6,6 @@
|
||||
bandit>=1.1.0 # Apache-2.0
|
||||
doc8>=0.6.0 # Apache-2.0
|
||||
coverage!=4.4,>=4.0 # Apache-2.0
|
||||
mock>=2.0.0 # BSD
|
||||
fixtures>=3.0.0 # Apache-2.0/BSD
|
||||
hacking>=3.0,<3.1.0 # Apache-2.0
|
||||
oslotest>=3.2.0 # Apache-2.0
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
import copy
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log
|
||||
from oslotest import base
|
||||
|
@ -35,10 +35,11 @@ For postgres on Ubuntu this can be done with the following commands:
|
||||
"""
|
||||
|
||||
import contextlib
|
||||
import fixtures
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
from alembic import script
|
||||
import mock
|
||||
import fixtures
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_db.sqlalchemy import enginefacade
|
||||
from oslo_db.sqlalchemy import test_base
|
||||
@ -49,7 +50,6 @@ import sqlalchemy.exc
|
||||
from zun.db.sqlalchemy import migration
|
||||
from zun.tests import base
|
||||
|
||||
import os
|
||||
|
||||
LOG = logging.getLogger(__name__)
|
||||
|
||||
|
@ -14,7 +14,7 @@
|
||||
# ceilometer/tests/api/__init__.py). This should be oslo'ified:
|
||||
# https://bugs.launchpad.net/ironic/+bug/1255115.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
# NOTE(deva): import auth_token so we can override a config option
|
||||
from keystonemiddleware import auth_token # noqa
|
||||
|
@ -11,7 +11,8 @@
|
||||
# limitations under the License.
|
||||
|
||||
import collections
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
from webob import exc
|
||||
|
||||
|
@ -10,8 +10,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from zun import objects
|
||||
from zun.tests.unit.api import base as api_base
|
||||
|
@ -10,8 +10,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from webtest.app import AppError
|
||||
|
||||
|
@ -10,13 +10,13 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from webtest.app import AppError
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from neutronclient.common import exceptions as n_exc
|
||||
from oslo_utils import uuidutils
|
||||
import six
|
||||
from webtest.app import AppError
|
||||
|
||||
from zun.common import exception
|
||||
from zun import objects
|
||||
|
@ -10,8 +10,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from webtest.app import AppError
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from webtest.app import AppError
|
||||
|
||||
from zun.common import exception
|
||||
import zun.conf
|
||||
|
@ -10,7 +10,8 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
from mock import patch
|
||||
from unittest.mock import patch
|
||||
|
||||
from zun.tests.unit.api import base as api_base
|
||||
from zun.tests.unit.db import utils
|
||||
|
||||
|
@ -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 zun.tests.unit.api import base as api_base
|
||||
|
||||
|
@ -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 zun.tests.unit.api import base as api_base
|
||||
|
||||
|
@ -10,11 +10,11 @@
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
import mock
|
||||
from mock import patch
|
||||
from webtest.app import AppError
|
||||
from unittest import mock
|
||||
from unittest.mock import patch
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from webtest.app import AppError
|
||||
|
||||
from zun import objects
|
||||
from zun.tests.unit.api import base as api_base
|
||||
|
@ -10,7 +10,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 zun.api import servicegroup
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_upgradecheck.upgradecheck import Code
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from cinderclient import client as cinderclient
|
||||
from glanceclient import client as glanceclient
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common import mount
|
||||
|
@ -14,7 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import inspect
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import importutils
|
||||
from osprofiler import initializer as profiler_init
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_serialization import jsonutils as json
|
||||
|
||||
from zun.common import context
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun.common import exception
|
||||
from zun.common import utils
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun.common import consts
|
||||
from zun.common import exception
|
||||
|
@ -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
|
||||
from six import StringIO
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun.compute import claims
|
||||
from zun.compute import compute_node_tracker
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun.common import exception
|
||||
from zun.compute import rpcapi
|
||||
|
@ -11,7 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
import six
|
||||
|
||||
|
@ -11,9 +11,9 @@
|
||||
# under the License.
|
||||
|
||||
from collections import defaultdict
|
||||
from docker import errors
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from docker import errors
|
||||
from oslo_utils import units
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
|
@ -12,11 +12,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import six
|
||||
from unittest import mock
|
||||
from unittest.mock import mock_open
|
||||
|
||||
from mock import mock_open
|
||||
from oslo_serialization import jsonutils
|
||||
import six
|
||||
|
||||
from zun.common import exception
|
||||
from zun.container.os_capability.linux import os_capability_linux
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from docker import errors
|
||||
|
||||
|
@ -12,10 +12,10 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import os
|
||||
import shutil
|
||||
import tempfile
|
||||
from unittest import mock
|
||||
|
||||
from zun.common import exception
|
||||
import zun.conf
|
||||
|
@ -13,7 +13,7 @@
|
||||
Tests For kuryr network
|
||||
"""
|
||||
import copy
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from neutronclient.common import exceptions as n_exc
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from testtools.matchers import HasLength
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import fixture as utils_fixture
|
||||
from oslo_utils import timeutils
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
from zun import objects
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
|
@ -12,8 +12,8 @@
|
||||
|
||||
import datetime
|
||||
import gettext
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from oslo_versionedobjects import exception as object_exception
|
||||
from oslo_versionedobjects import fields
|
||||
from oslo_versionedobjects import fixture
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun import objects
|
||||
from zun.tests.unit.db import base
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun.common import consts
|
||||
from zun import objects
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from testtools.matchers import HasLength
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import uuidutils
|
||||
from testtools.matchers import HasLength
|
||||
|
@ -10,7 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from testtools.matchers import HasLength
|
||||
|
||||
from zun import objects
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import functools
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
|
||||
from zun.pci import whitelist
|
||||
|
||||
|
@ -12,7 +12,8 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import six
|
||||
|
||||
from zun.common import exception
|
||||
|
@ -14,8 +14,7 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import zun
|
||||
from zun.common import context
|
||||
|
@ -13,7 +13,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 zun.common import exception
|
||||
|
@ -16,9 +16,9 @@
|
||||
|
||||
import glob
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from six.moves import builtins
|
||||
|
||||
from zun.common import exception
|
||||
|
@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
|
||||
|
@ -11,10 +11,10 @@
|
||||
# under the License.
|
||||
import copy
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
from keystoneauth1 import exceptions as ks_exc
|
||||
import mock
|
||||
import os_resource_classes as orc
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
@ -10,7 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from zun.common import context
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun import objects
|
||||
from zun.pci import stats
|
||||
|
@ -13,8 +13,8 @@
|
||||
Tests for base filter
|
||||
"""
|
||||
import inspect
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
|
||||
from zun.scheduler import base_filters
|
||||
from zun.tests import base
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun.common import exception
|
||||
from zun import objects
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
Tests For Scheduler
|
||||
"""
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from zun import objects
|
||||
from zun.tests import base
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import zun.conf
|
||||
from zun import objects
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
import textwrap
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import pycodestyle
|
||||
|
||||
from zun.hacking import checks
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from cinderclient import exceptions as cinder_exception
|
||||
from oslo_utils import timeutils
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from cinderclient import exceptions as cinder_exception
|
||||
from os_brick import exception as os_brick_exception
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import uuidutils
|
||||
|
Loading…
x
Reference in New Issue
Block a user