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. Most of this is autogenerated, as described below, but there is one manual change necessary: nova/tests/functional/regressions/test_bug_1781286.py We need to avoid using 'fixtures.MockPatch' since fixtures is using 'mock' (the library) under the hood and a call to 'mock.patch.stop' found in that test will now "stop" mocks from the wrong library. We have discussed making this configurable but the option proposed isn't that pretty [1] so this is better. The remainder was auto-generated with the following (hacky) script, with one or two manual tweaks after the fact: import glob for path in glob.glob('nova/tests/**/*.py', recursive=True): with open(path) as fh: lines = fh.readlines() if 'import mock\n' not in lines: continue import_group_found = False create_first_party_group = False for num, line in enumerate(lines): line = line.strip() if line.startswith('import ') or line.startswith('from '): tokens = line.split() for lib in ( 'ddt', 'six', 'webob', 'fixtures', 'testtools' 'neutron', 'cinder', 'ironic', 'keystone', 'oslo', ): if lib in tokens[1]: create_first_party_group = True break if create_first_party_group: break import_group_found = True if not import_group_found: continue if line.startswith('import ') or line.startswith('from '): tokens = line.split() if tokens[1] > 'unittest': break elif tokens[1] == 'unittest' and ( len(tokens) == 2 or tokens[4] > 'mock' ): break elif not line: break if create_first_party_group: lines.insert(num, 'from unittest import mock\n\n') else: lines.insert(num, 'from unittest import mock\n') del lines[lines.index('import mock\n')] with open(path, 'w+') as fh: fh.writelines(lines) Note that we cannot remove mock from our requirements files yet due to importing pypowervm unit test code in nova unit tests. This library still uses the mock lib, and since we are importing test code and that lib (correctly) only declares mock in its test-requirements.txt, mock would not otherwise be installed and would cause errors while loading nova unit test code. [1] https://github.com/testing-cabal/fixtures/pull/49 Change-Id: Id5b04cf2f6ca24af8e366d23f15cf0e5cac8e1cc Signed-off-by: Stephen Finucane <stephenfin@redhat.com>
This commit is contained in:
parent
1a32196074
commit
89ef050b8c
@ -35,9 +35,9 @@ import os
|
||||
import os.path
|
||||
import pprint
|
||||
import sys
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_cache import core as cache
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
|
2
nova/tests/fixtures/libvirt.py
vendored
2
nova/tests/fixtures/libvirt.py
vendored
@ -18,10 +18,10 @@ import sys
|
||||
import textwrap
|
||||
import time
|
||||
import typing as ty
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
from lxml import etree
|
||||
import mock
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
from oslo_utils import versionutils
|
||||
|
2
nova/tests/fixtures/libvirt_imagebackend.py
vendored
2
nova/tests/fixtures/libvirt_imagebackend.py
vendored
@ -16,9 +16,9 @@
|
||||
import collections
|
||||
import functools
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
|
||||
from nova.virt.libvirt import config
|
||||
from nova.virt.libvirt import driver
|
||||
|
12
nova/tests/fixtures/nova.py
vendored
12
nova/tests/fixtures/nova.py
vendored
@ -23,12 +23,13 @@ import functools
|
||||
import logging as std_logging
|
||||
import os
|
||||
import time
|
||||
from unittest import mock
|
||||
import warnings
|
||||
|
||||
import eventlet
|
||||
import fixtures
|
||||
import futurist
|
||||
import mock
|
||||
import mock as mock_the_lib
|
||||
from openstack import service_description
|
||||
from oslo_concurrency import lockutils
|
||||
from oslo_config import cfg
|
||||
@ -1607,7 +1608,14 @@ class GenericPoisonFixture(fixtures.Fixture):
|
||||
current = __import__(components[0], {}, {})
|
||||
for component in components[1:]:
|
||||
current = getattr(current, component)
|
||||
if not isinstance(getattr(current, attribute), mock.Mock):
|
||||
|
||||
# TODO(stephenfin): Remove mock_the_lib check once pypowervm is
|
||||
# no longer using mock and we no longer have mock in
|
||||
# requirements
|
||||
if not isinstance(
|
||||
getattr(current, attribute),
|
||||
(mock.Mock, mock_the_lib.Mock),
|
||||
):
|
||||
self.useFixture(fixtures.MonkeyPatch(
|
||||
meth, poison_configure(meth, why)))
|
||||
except ImportError:
|
||||
|
3
nova/tests/fixtures/os_brick.py
vendored
3
nova/tests/fixtures/os_brick.py
vendored
@ -10,8 +10,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
|
||||
from os_brick.initiator import connector as brick_connector
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
|
||||
from nova import test
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova.tests import fixtures
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import objects
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova.tests.functional.api_sample_tests import api_sample_base
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import versionutils
|
||||
|
||||
from nova import exception
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import exception
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
@ -14,9 +14,9 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import futurist
|
||||
import mock
|
||||
|
||||
from nova.conductor import manager as conductor_manager
|
||||
from nova 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 nova.tests.functional.api_sample_tests import test_servers
|
||||
|
||||
|
@ -13,9 +13,9 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
from urllib import parse
|
||||
|
||||
import mock
|
||||
from oslo_utils import timeutils
|
||||
|
||||
from nova.tests.functional.api_sample_tests import test_servers
|
||||
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
from nova import context as nova_context
|
||||
from nova import objects
|
||||
|
@ -12,7 +12,8 @@
|
||||
# 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.fixture import uuidsentinel as uuids
|
||||
|
||||
|
@ -12,9 +12,9 @@
|
||||
|
||||
import copy
|
||||
import os
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
import os_resource_classes as orc
|
||||
import os_traits
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
@ -11,8 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
from copy import deepcopy
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from oslo_db import exception as db_exc
|
||||
from oslo_utils.fixture import uuidsentinel
|
||||
from oslo_utils import timeutils
|
||||
|
@ -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.fixture import uuidsentinel as uuids
|
||||
|
||||
from nova.compute import api as compute_api
|
||||
|
@ -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.fixture import uuidsentinel as uuids
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
@ -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.fixture import uuidsentinel as uuids
|
||||
from oslo_versionedobjects import fixture as ovo_fixture
|
||||
|
||||
|
@ -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.fixture import uuidsentinel
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
|
@ -10,8 +10,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
from oslo_utils import uuidutils
|
||||
|
||||
from nova import context
|
||||
|
@ -11,7 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_utils import timeutils
|
||||
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
import copy
|
||||
import io
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
|
||||
from nova import conf
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
@ -13,10 +13,10 @@
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
import fixtures
|
||||
import mock
|
||||
import os.path
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
from oslo_utils import fileutils
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
from oslo_utils import units
|
||||
|
@ -13,11 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import testtools
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
import testtools
|
||||
|
||||
import nova
|
||||
from nova.compute import manager
|
||||
|
@ -14,12 +14,12 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import ddt
|
||||
import fixtures
|
||||
from lxml import etree
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import jsonutils
|
||||
|
@ -13,11 +13,11 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import os_resource_classes as orc
|
||||
import os_traits as ost
|
||||
|
||||
|
||||
from nova import conf
|
||||
from nova.db import constants as db_const
|
||||
from nova import test
|
||||
|
@ -12,7 +12,7 @@
|
||||
# under the License.
|
||||
|
||||
import io
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from castellan.common.objects import passphrase
|
||||
from castellan.key_manager import key_manager
|
||||
|
@ -12,9 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
import os
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
from oslo_config import cfg
|
||||
from oslo_serialization import jsonutils
|
||||
|
@ -11,8 +11,8 @@
|
||||
# under the License.
|
||||
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
|
||||
from nova import exception
|
||||
from nova.tests import fixtures
|
||||
|
@ -12,8 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
|
||||
import nova.conf
|
||||
from nova import exception
|
||||
|
@ -12,8 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from cinderclient import exceptions as cinder_exceptions
|
||||
import mock
|
||||
|
||||
from nova import test
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
@ -13,10 +13,10 @@
|
||||
# under the License.
|
||||
|
||||
import time
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import io
|
||||
import mock
|
||||
|
||||
from nova import test
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
@ -10,8 +10,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_db import exception as oslo_db_exc
|
||||
|
||||
from nova.compute import manager as compute_manager
|
||||
@ -67,10 +67,10 @@ class RescheduleBuildAvailabilityZoneUpCall(
|
||||
def wrap_bari(*args, **kwargs):
|
||||
# Poison the AZ query to blow up as if the cell conductor does not
|
||||
# have access to the API DB.
|
||||
self.useFixture(
|
||||
fixtures.MockPatch(
|
||||
'nova.objects.AggregateList.get_by_host',
|
||||
side_effect=oslo_db_exc.CantStartEngineError))
|
||||
patcher = mock.patch('nova.objects.AggregateList.get_by_host',
|
||||
side_effect=oslo_db_exc.CantStartEngineError)
|
||||
patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
return original_bari(*args, **kwargs)
|
||||
|
||||
self.stub_out('nova.compute.manager.ComputeManager.'
|
||||
@ -130,10 +130,11 @@ class RescheduleMigrateAvailabilityZoneUpCall(
|
||||
def wrap_prep_resize(_self, *args, **kwargs):
|
||||
# Poison the AZ query to blow up as if the cell conductor does not
|
||||
# have access to the API DB.
|
||||
self.agg_mock = self.useFixture(
|
||||
fixtures.MockPatch(
|
||||
'nova.objects.AggregateList.get_by_host',
|
||||
side_effect=oslo_db_exc.CantStartEngineError)).mock
|
||||
patcher = mock.patch('nova.objects.AggregateList.get_by_host',
|
||||
side_effect=oslo_db_exc.CantStartEngineError)
|
||||
self.agg_mock = patcher.start()
|
||||
self.addCleanup(patcher.stop)
|
||||
|
||||
if self.rescheduled is None:
|
||||
# Track the first host that we rescheduled from.
|
||||
self.rescheduled = _self.host
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova.conductor import api as conductor_api
|
||||
from nova import context as nova_context
|
||||
|
@ -13,8 +13,8 @@
|
||||
# under the License.
|
||||
|
||||
import collections
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
|
||||
from nova.compute import task_states
|
||||
from nova.compute import vm_states
|
||||
|
@ -9,7 +9,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
|
||||
|
||||
import nova.compute
|
||||
from nova import exception
|
||||
|
@ -9,7 +9,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
|
||||
|
||||
import nova
|
||||
from nova import exception
|
||||
|
@ -9,7 +9,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
|
||||
|
||||
import nova
|
||||
from nova.tests.functional import integrated_helpers
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import context
|
||||
from nova import objects
|
||||
|
@ -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.
|
||||
import mock
|
||||
from neutronclient.common import exceptions as neutron_exception
|
||||
from unittest import mock
|
||||
|
||||
from nova import test
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
@ -10,8 +10,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import ddt
|
||||
import mock
|
||||
|
||||
from nova.compute import resource_tracker as rt
|
||||
from nova import context as nova_context
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import test
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import context
|
||||
from nova 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 nova import context as nova_context
|
||||
from nova import exception
|
||||
|
@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import context
|
||||
from nova 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 nova import context
|
||||
from nova 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 nova import exception as nova_exceptions
|
||||
from nova.tests.fixtures import libvirt as fakelibvirt
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import context
|
||||
from nova 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 nova.compute import api as compute_api
|
||||
from nova import context as nova_context
|
||||
|
@ -10,8 +10,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
|
||||
from nova import context
|
||||
from nova.network import model as network_model
|
||||
|
@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_db import exception as oslo_db_exc
|
||||
from oslo_utils import fixture as osloutils_fixture
|
||||
|
@ -12,7 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_policy import policy as oslo_policy
|
||||
|
||||
from nova import exception
|
||||
|
@ -15,9 +15,9 @@ import collections
|
||||
import datetime
|
||||
from io import StringIO
|
||||
import os.path
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from neutronclient.common import exceptions as neutron_client_exc
|
||||
import os_resource_classes as orc
|
||||
from oslo_serialization import jsonutils
|
||||
|
@ -12,10 +12,11 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
|
||||
import ddt
|
||||
from keystoneauth1 import exceptions as kse
|
||||
import microversion_parse
|
||||
import mock
|
||||
import os_resource_classes as orc
|
||||
import os_traits as ot
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
@ -11,7 +11,7 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
||||
|
@ -10,7 +10,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova import test
|
||||
from nova.tests import fixtures as nova_fixtures
|
||||
|
@ -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 nova.compute import instance_actions
|
||||
|
@ -17,10 +17,10 @@ import collections
|
||||
import copy
|
||||
import datetime
|
||||
import time
|
||||
from unittest import mock
|
||||
import zlib
|
||||
|
||||
from keystoneauth1 import adapter
|
||||
import mock
|
||||
from oslo_config import cfg
|
||||
from oslo_log import log as logging
|
||||
from oslo_serialization import base64
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
|
||||
import mock
|
||||
import os_traits
|
||||
from unittest import mock
|
||||
|
||||
from oslo_log import log as logging
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
@ -14,9 +14,9 @@
|
||||
|
||||
import copy
|
||||
import logging
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import adapter
|
||||
import mock
|
||||
from neutronclient.common import exceptions as neutron_exception
|
||||
import os_resource_classes as orc
|
||||
from oslo_config import cfg
|
||||
|
@ -13,7 +13,7 @@
|
||||
# under the License.
|
||||
|
||||
import itertools
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from keystoneauth1 import exceptions as ks_exc
|
||||
from requests.models import Response
|
||||
|
@ -12,8 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_utils import timeutils
|
||||
from oslo_utils import uuidutils
|
||||
import webob
|
||||
|
@ -13,7 +13,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 mock
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import webob
|
||||
|
||||
from nova.api.openstack.compute import admin_password as admin_password_v21
|
||||
|
@ -15,7 +15,8 @@
|
||||
|
||||
"""Tests for the aggregates admin api."""
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils.fixture import uuidsentinel
|
||||
from webob import exc
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import common
|
||||
|
@ -13,9 +13,9 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
import mock
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils.fixture import uuidsentinel
|
||||
|
||||
|
@ -13,13 +13,12 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
from ironicclient import exc as ironic_exc
|
||||
import mock
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack.compute import baremetal_nodes \
|
||||
as b_nodes_v21
|
||||
from nova.api.openstack.compute import baremetal_nodes as b_nodes_v21
|
||||
from nova import context
|
||||
from nova import exception
|
||||
from nova import test
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import webob
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import string
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import webob
|
||||
|
||||
from nova.api.openstack.compute import console_output \
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils import timeutils
|
||||
import webob
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import webob
|
||||
|
||||
from nova.api.openstack.compute import deferred_delete as dd_v21
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from nova.api.openstack import compute
|
||||
|
@ -12,8 +12,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
import testtools
|
||||
import webob
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from webob import exc
|
||||
|
||||
from nova.api.openstack import api_version_request as api_version
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from oslo_serialization import jsonutils
|
||||
import webob
|
||||
|
||||
|
@ -13,9 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
import webob
|
||||
|
||||
from nova.api.openstack import common
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import testtools
|
||||
import webob
|
||||
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova.api.openstack.compute import floating_ip_pools \
|
||||
as fipp_v21
|
||||
|
@ -14,7 +14,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
import webob
|
||||
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_utils.fixture import uuidsentinel
|
||||
import testtools
|
||||
import webob.exc
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
import netaddr
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
|
@ -14,8 +14,8 @@
|
||||
# under the License.
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from oslo_serialization import jsonutils
|
||||
import webob
|
||||
|
||||
|
@ -19,9 +19,9 @@ and as a WSGI layer
|
||||
"""
|
||||
|
||||
import copy
|
||||
from unittest import mock
|
||||
from urllib import parse as urlparse
|
||||
|
||||
import mock
|
||||
import webob
|
||||
|
||||
from nova.api.openstack.compute import images as images_v21
|
||||
|
@ -15,9 +15,9 @@
|
||||
|
||||
import copy
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
import mock
|
||||
from oslo_policy import policy as oslo_policy
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
from webob import exc
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import webob
|
||||
|
||||
from nova.api.openstack.compute import keypairs as keypairs_v21
|
||||
|
@ -19,8 +19,8 @@ Tests dealing with HTTP rate-limiting.
|
||||
|
||||
from http import client as httplib
|
||||
from io import StringIO
|
||||
from unittest import mock
|
||||
|
||||
import mock
|
||||
from oslo_limit import fixture as limit_fixture
|
||||
from oslo_serialization import jsonutils
|
||||
from oslo_utils import encodeutils
|
||||
|
@ -13,7 +13,7 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
from nova.api.openstack import common
|
||||
|
@ -12,7 +12,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_serialization import jsonutils
|
||||
|
||||
from nova.api.openstack import api_version_request as api_version
|
||||
|
@ -13,8 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
from oslo_utils import uuidutils
|
||||
import webob
|
||||
|
@ -13,9 +13,9 @@
|
||||
# under the License.
|
||||
|
||||
import datetime
|
||||
from unittest import mock
|
||||
|
||||
import iso8601
|
||||
import mock
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
from webob import exc
|
||||
|
||||
|
@ -13,8 +13,9 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
from unittest import mock
|
||||
|
||||
import fixtures
|
||||
import mock
|
||||
import webob
|
||||
|
||||
from nova.api.openstack.compute import multinic as multinic_v21
|
||||
|
@ -12,8 +12,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 copy
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_limit import fixture as limit_fixture
|
||||
import webob
|
||||
|
||||
|
@ -14,7 +14,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
from oslo_limit import fixture as limit_fixture
|
||||
from oslo_utils.fixture import uuidsentinel as uuids
|
||||
import webob
|
||||
|
@ -13,7 +13,8 @@
|
||||
# License for the specific language governing permissions and limitations
|
||||
# under the License.
|
||||
|
||||
import mock
|
||||
from unittest import mock
|
||||
|
||||
import webob
|
||||
|
||||
from nova.api.openstack import api_version_request
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user