diff options
Diffstat (limited to 'nova/tests')
413 files changed, 604 insertions, 439 deletions
diff --git a/nova/tests/fixtures/libvirt.py b/nova/tests/fixtures/libvirt.py index f6d5d656a2..46b2313cbe 100644 --- a/nova/tests/fixtures/libvirt.py +++ b/nova/tests/fixtures/libvirt.py @@ -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 diff --git a/nova/tests/fixtures/libvirt_imagebackend.py b/nova/tests/fixtures/libvirt_imagebackend.py index c3b6f7898e..3d6f2e81e9 100644 --- a/nova/tests/fixtures/libvirt_imagebackend.py +++ b/nova/tests/fixtures/libvirt_imagebackend.py @@ -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 diff --git a/nova/tests/fixtures/nova.py b/nova/tests/fixtures/nova.py index b3041743cf..0a074535d7 100644 --- a/nova/tests/fixtures/nova.py +++ b/nova/tests/fixtures/nova.py @@ -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: diff --git a/nova/tests/fixtures/os_brick.py b/nova/tests/fixtures/os_brick.py index e636e8b8f5..2062e8ed14 100644 --- a/nova/tests/fixtures/os_brick.py +++ b/nova/tests/fixtures/os_brick.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py b/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py index 59ef2496b5..569df728e3 100644 --- a/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py +++ b/nova/tests/functional/api_sample_tests/test_baremetal_nodes.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_compare_result.py b/nova/tests/functional/api_sample_tests/test_compare_result.py index 652b9c9035..1b68439184 100644 --- a/nova/tests/functional/api_sample_tests/test_compare_result.py +++ b/nova/tests/functional/api_sample_tests/test_compare_result.py @@ -13,8 +13,8 @@ # under the License. import copy +from unittest import mock -import mock import testtools from nova import test diff --git a/nova/tests/functional/api_sample_tests/test_create_backup.py b/nova/tests/functional/api_sample_tests/test_create_backup.py index 2e5758c36e..cf454e948b 100644 --- a/nova/tests/functional/api_sample_tests/test_create_backup.py +++ b/nova/tests/functional/api_sample_tests/test_create_backup.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_evacuate.py b/nova/tests/functional/api_sample_tests/test_evacuate.py index 1b12e2caf4..14b7b09cf0 100644 --- a/nova/tests/functional/api_sample_tests/test_evacuate.py +++ b/nova/tests/functional/api_sample_tests/test_evacuate.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_hypervisors.py b/nova/tests/functional/api_sample_tests/test_hypervisors.py index f402f9ebde..f5832ab4ac 100644 --- a/nova/tests/functional/api_sample_tests/test_hypervisors.py +++ b/nova/tests/functional/api_sample_tests/test_hypervisors.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_migrate_server.py b/nova/tests/functional/api_sample_tests/test_migrate_server.py index 59321c845a..5fe7070410 100644 --- a/nova/tests/functional/api_sample_tests/test_migrate_server.py +++ b/nova/tests/functional/api_sample_tests/test_migrate_server.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_networks.py b/nova/tests/functional/api_sample_tests/test_networks.py index 0a75d156cb..dd5d945e2a 100644 --- a/nova/tests/functional/api_sample_tests/test_networks.py +++ b/nova/tests/functional/api_sample_tests/test_networks.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_server_migrations.py b/nova/tests/functional/api_sample_tests/test_server_migrations.py index 15fb72945c..8ee3b6a36a 100644 --- a/nova/tests/functional/api_sample_tests/test_server_migrations.py +++ b/nova/tests/functional/api_sample_tests/test_server_migrations.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_server_password.py b/nova/tests/functional/api_sample_tests/test_server_password.py index 11921291f1..8c4800103b 100644 --- a/nova/tests/functional/api_sample_tests/test_server_password.py +++ b/nova/tests/functional/api_sample_tests/test_server_password.py @@ -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 diff --git a/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py b/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py index 5ee3ba7163..36b224510d 100644 --- a/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py +++ b/nova/tests/functional/api_sample_tests/test_simple_tenant_usage.py @@ -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 diff --git a/nova/tests/functional/compute/test_init_host.py b/nova/tests/functional/compute/test_init_host.py index f506f6ed59..f5c821e116 100644 --- a/nova/tests/functional/compute/test_init_host.py +++ b/nova/tests/functional/compute/test_init_host.py @@ -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 diff --git a/nova/tests/functional/compute/test_live_migration.py b/nova/tests/functional/compute/test_live_migration.py index b4d68cd1d5..fb7315a23c 100644 --- a/nova/tests/functional/compute/test_live_migration.py +++ b/nova/tests/functional/compute/test_live_migration.py @@ -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 diff --git a/nova/tests/functional/compute/test_resource_tracker.py b/nova/tests/functional/compute/test_resource_tracker.py index 81b7dfb68c..24d72f56ee 100644 --- a/nova/tests/functional/compute/test_resource_tracker.py +++ b/nova/tests/functional/compute/test_resource_tracker.py @@ -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 diff --git a/nova/tests/functional/db/test_aggregate.py b/nova/tests/functional/db/test_aggregate.py index 35d9024576..be3cd67e38 100644 --- a/nova/tests/functional/db/test_aggregate.py +++ b/nova/tests/functional/db/test_aggregate.py @@ -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 diff --git a/nova/tests/functional/db/test_compute_api.py b/nova/tests/functional/db/test_compute_api.py index 49fa10281a..0cf3e4f5e9 100644 --- a/nova/tests/functional/db/test_compute_api.py +++ b/nova/tests/functional/db/test_compute_api.py @@ -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 diff --git a/nova/tests/functional/db/test_host_mapping.py b/nova/tests/functional/db/test_host_mapping.py index e4b5a365a7..3d0c5575ca 100644 --- a/nova/tests/functional/db/test_host_mapping.py +++ b/nova/tests/functional/db/test_host_mapping.py @@ -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 diff --git a/nova/tests/functional/db/test_instance_group.py b/nova/tests/functional/db/test_instance_group.py index 50314f17ac..6a801f2a55 100644 --- a/nova/tests/functional/db/test_instance_group.py +++ b/nova/tests/functional/db/test_instance_group.py @@ -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 diff --git a/nova/tests/functional/db/test_instance_mapping.py b/nova/tests/functional/db/test_instance_mapping.py index 1b740df629..ef78e7910a 100644 --- a/nova/tests/functional/db/test_instance_mapping.py +++ b/nova/tests/functional/db/test_instance_mapping.py @@ -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 diff --git a/nova/tests/functional/db/test_quota.py b/nova/tests/functional/db/test_quota.py index 8c2b637269..cdadebd408 100644 --- a/nova/tests/functional/db/test_quota.py +++ b/nova/tests/functional/db/test_quota.py @@ -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 diff --git a/nova/tests/functional/db/test_virtual_interface.py b/nova/tests/functional/db/test_virtual_interface.py index 0d64f99cc8..2accb80c01 100644 --- a/nova/tests/functional/db/test_virtual_interface.py +++ b/nova/tests/functional/db/test_virtual_interface.py @@ -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 diff --git a/nova/tests/functional/libvirt/base.py b/nova/tests/functional/libvirt/base.py index c325c0b040..131dd96314 100644 --- a/nova/tests/functional/libvirt/base.py +++ b/nova/tests/functional/libvirt/base.py @@ -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 diff --git a/nova/tests/functional/libvirt/test_evacuate.py b/nova/tests/functional/libvirt/test_evacuate.py index 531cefc63c..9d3deec99d 100644 --- a/nova/tests/functional/libvirt/test_evacuate.py +++ b/nova/tests/functional/libvirt/test_evacuate.py @@ -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 diff --git a/nova/tests/functional/libvirt/test_numa_servers.py b/nova/tests/functional/libvirt/test_numa_servers.py index 7f2ddd0992..e4c2b9317d 100644 --- a/nova/tests/functional/libvirt/test_numa_servers.py +++ b/nova/tests/functional/libvirt/test_numa_servers.py @@ -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 diff --git a/nova/tests/functional/libvirt/test_pci_sriov_servers.py b/nova/tests/functional/libvirt/test_pci_sriov_servers.py index e045bc64d9..df3e0468b9 100644 --- a/nova/tests/functional/libvirt/test_pci_sriov_servers.py +++ b/nova/tests/functional/libvirt/test_pci_sriov_servers.py @@ -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 diff --git a/nova/tests/functional/libvirt/test_report_cpu_traits.py b/nova/tests/functional/libvirt/test_report_cpu_traits.py index 2386ec5251..eb984c5145 100644 --- a/nova/tests/functional/libvirt/test_report_cpu_traits.py +++ b/nova/tests/functional/libvirt/test_report_cpu_traits.py @@ -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 diff --git a/nova/tests/functional/libvirt/test_reshape.py b/nova/tests/functional/libvirt/test_reshape.py index 5c73ffbf5f..73f64b6972 100644 --- a/nova/tests/functional/libvirt/test_reshape.py +++ b/nova/tests/functional/libvirt/test_reshape.py @@ -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 diff --git a/nova/tests/functional/libvirt/test_vtpm.py b/nova/tests/functional/libvirt/test_vtpm.py index c07c38f02d..68e8a37ed5 100644 --- a/nova/tests/functional/libvirt/test_vtpm.py +++ b/nova/tests/functional/libvirt/test_vtpm.py @@ -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 diff --git a/nova/tests/functional/notification_sample_tests/notification_sample_base.py b/nova/tests/functional/notification_sample_tests/notification_sample_base.py index 72291e55cd..d987ff127c 100644 --- a/nova/tests/functional/notification_sample_tests/notification_sample_base.py +++ b/nova/tests/functional/notification_sample_tests/notification_sample_base.py @@ -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 diff --git a/nova/tests/functional/notification_sample_tests/test_instance.py b/nova/tests/functional/notification_sample_tests/test_instance.py index 52200849b1..b8ab0ee9ba 100644 --- a/nova/tests/functional/notification_sample_tests/test_instance.py +++ b/nova/tests/functional/notification_sample_tests/test_instance.py @@ -11,8 +11,8 @@ # under the License. import time +from unittest import mock -import mock from nova import exception from nova.tests import fixtures diff --git a/nova/tests/functional/notification_sample_tests/test_libvirt.py b/nova/tests/functional/notification_sample_tests/test_libvirt.py index 8106edd44a..feed05a64c 100644 --- a/nova/tests/functional/notification_sample_tests/test_libvirt.py +++ b/nova/tests/functional/notification_sample_tests/test_libvirt.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1554631.py b/nova/tests/functional/regressions/test_bug_1554631.py index 2db5e37b91..25a4613e72 100644 --- a/nova/tests/functional/regressions/test_bug_1554631.py +++ b/nova/tests/functional/regressions/test_bug_1554631.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1595962.py b/nova/tests/functional/regressions/test_bug_1595962.py index ebdf82f21a..94421a81f9 100644 --- a/nova/tests/functional/regressions/test_bug_1595962.py +++ b/nova/tests/functional/regressions/test_bug_1595962.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1781286.py b/nova/tests/functional/regressions/test_bug_1781286.py index 7b2d603092..05771f4b42 100644 --- a/nova/tests/functional/regressions/test_bug_1781286.py +++ b/nova/tests/functional/regressions/test_bug_1781286.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1830747.py b/nova/tests/functional/regressions/test_bug_1830747.py index 4cd8c3b1af..a28c896b99 100644 --- a/nova/tests/functional/regressions/test_bug_1830747.py +++ b/nova/tests/functional/regressions/test_bug_1830747.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1831771.py b/nova/tests/functional/regressions/test_bug_1831771.py index 2ec448b249..11e3ec7682 100644 --- a/nova/tests/functional/regressions/test_bug_1831771.py +++ b/nova/tests/functional/regressions/test_bug_1831771.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1843090.py b/nova/tests/functional/regressions/test_bug_1843090.py index ed02d59cb4..72793cc0bc 100644 --- a/nova/tests/functional/regressions/test_bug_1843090.py +++ b/nova/tests/functional/regressions/test_bug_1843090.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1845291.py b/nova/tests/functional/regressions/test_bug_1845291.py index 101774416a..e5e9c953a6 100644 --- a/nova/tests/functional/regressions/test_bug_1845291.py +++ b/nova/tests/functional/regressions/test_bug_1845291.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1849165.py b/nova/tests/functional/regressions/test_bug_1849165.py index f2a7f82ee9..1d4cf2eece 100644 --- a/nova/tests/functional/regressions/test_bug_1849165.py +++ b/nova/tests/functional/regressions/test_bug_1849165.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1853009.py b/nova/tests/functional/regressions/test_bug_1853009.py index 2ec69482a2..5266e6166b 100644 --- a/nova/tests/functional/regressions/test_bug_1853009.py +++ b/nova/tests/functional/regressions/test_bug_1853009.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1862633.py b/nova/tests/functional/regressions/test_bug_1862633.py index 5cfcc75ab2..021093cf59 100644 --- a/nova/tests/functional/regressions/test_bug_1862633.py +++ b/nova/tests/functional/regressions/test_bug_1862633.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1879878.py b/nova/tests/functional/regressions/test_bug_1879878.py index 3a21c5c11d..c50f8ac92e 100644 --- a/nova/tests/functional/regressions/test_bug_1879878.py +++ b/nova/tests/functional/regressions/test_bug_1879878.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1889108.py b/nova/tests/functional/regressions/test_bug_1889108.py index 0e847e81ab..9ec67e4bf7 100644 --- a/nova/tests/functional/regressions/test_bug_1889108.py +++ b/nova/tests/functional/regressions/test_bug_1889108.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1899835.py b/nova/tests/functional/regressions/test_bug_1899835.py index 4713763f0f..ad4d315659 100644 --- a/nova/tests/functional/regressions/test_bug_1899835.py +++ b/nova/tests/functional/regressions/test_bug_1899835.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1914777.py b/nova/tests/functional/regressions/test_bug_1914777.py index d8c9f5e15f..470c852669 100644 --- a/nova/tests/functional/regressions/test_bug_1914777.py +++ b/nova/tests/functional/regressions/test_bug_1914777.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1928063.py b/nova/tests/functional/regressions/test_bug_1928063.py index b1b1d36e16..2c773981c5 100644 --- a/nova/tests/functional/regressions/test_bug_1928063.py +++ b/nova/tests/functional/regressions/test_bug_1928063.py @@ -11,7 +11,7 @@ # under the License. import copy -import mock +from unittest import mock from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/functional/regressions/test_bug_1937084.py b/nova/tests/functional/regressions/test_bug_1937084.py index 3ef432ae5e..bec3c9f5cb 100644 --- a/nova/tests/functional/regressions/test_bug_1937084.py +++ b/nova/tests/functional/regressions/test_bug_1937084.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1937375.py b/nova/tests/functional/regressions/test_bug_1937375.py index 860d80acd7..13a1f5c4c9 100644 --- a/nova/tests/functional/regressions/test_bug_1937375.py +++ b/nova/tests/functional/regressions/test_bug_1937375.py @@ -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 diff --git a/nova/tests/functional/regressions/test_bug_1944619.py b/nova/tests/functional/regressions/test_bug_1944619.py index 82b7475dca..bdd06c493f 100644 --- a/nova/tests/functional/regressions/test_bug_1944619.py +++ b/nova/tests/functional/regressions/test_bug_1944619.py @@ -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 diff --git a/nova/tests/functional/test_boot_from_volume.py b/nova/tests/functional/test_boot_from_volume.py index 45555b002d..0b963b5aa3 100644 --- a/nova/tests/functional/test_boot_from_volume.py +++ b/nova/tests/functional/test_boot_from_volume.py @@ -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 diff --git a/nova/tests/functional/test_cold_migrate.py b/nova/tests/functional/test_cold_migrate.py index e07820ba2a..b78db14a14 100644 --- a/nova/tests/functional/test_cold_migrate.py +++ b/nova/tests/functional/test_cold_migrate.py @@ -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 diff --git a/nova/tests/functional/test_compute_mgr.py b/nova/tests/functional/test_compute_mgr.py index 38b7f9d7a6..d8892843b4 100644 --- a/nova/tests/functional/test_compute_mgr.py +++ b/nova/tests/functional/test_compute_mgr.py @@ -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 diff --git a/nova/tests/functional/test_cross_cell_migrate.py b/nova/tests/functional/test_cross_cell_migrate.py index a1186ca7a5..92cf805945 100644 --- a/nova/tests/functional/test_cross_cell_migrate.py +++ b/nova/tests/functional/test_cross_cell_migrate.py @@ -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 diff --git a/nova/tests/functional/test_instance_actions.py b/nova/tests/functional/test_instance_actions.py index 054def5183..c20b053459 100644 --- a/nova/tests/functional/test_instance_actions.py +++ b/nova/tests/functional/test_instance_actions.py @@ -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 diff --git a/nova/tests/functional/test_nova_manage.py b/nova/tests/functional/test_nova_manage.py index b6fddc84b2..888b43cea0 100644 --- a/nova/tests/functional/test_nova_manage.py +++ b/nova/tests/functional/test_nova_manage.py @@ -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 diff --git a/nova/tests/functional/test_report_client.py b/nova/tests/functional/test_report_client.py index 81003f53f0..ba4b729b87 100644 --- a/nova/tests/functional/test_report_client.py +++ b/nova/tests/functional/test_report_client.py @@ -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 diff --git a/nova/tests/functional/test_routed_networks.py b/nova/tests/functional/test_routed_networks.py index 19c5d3c59f..616780a219 100644 --- a/nova/tests/functional/test_routed_networks.py +++ b/nova/tests/functional/test_routed_networks.py @@ -11,7 +11,7 @@ # under the License. import copy -import mock +from unittest import mock from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/functional/test_server_faults.py b/nova/tests/functional/test_server_faults.py index 91f813f070..edc3c3b377 100644 --- a/nova/tests/functional/test_server_faults.py +++ b/nova/tests/functional/test_server_faults.py @@ -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 diff --git a/nova/tests/functional/test_server_group.py b/nova/tests/functional/test_server_group.py index 08e47b3971..93c725af1b 100644 --- a/nova/tests/functional/test_server_group.py +++ b/nova/tests/functional/test_server_group.py @@ -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 diff --git a/nova/tests/functional/test_servers.py b/nova/tests/functional/test_servers.py index f65dd59902..d5b1b58e4b 100644 --- a/nova/tests/functional/test_servers.py +++ b/nova/tests/functional/test_servers.py @@ -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 diff --git a/nova/tests/functional/test_servers_provider_tree.py b/nova/tests/functional/test_servers_provider_tree.py index 0eff6c6bda..f48f91dc02 100644 --- a/nova/tests/functional/test_servers_provider_tree.py +++ b/nova/tests/functional/test_servers_provider_tree.py @@ -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 diff --git a/nova/tests/functional/test_servers_resource_request.py b/nova/tests/functional/test_servers_resource_request.py index 1fb39ac98a..09983e1d35 100644 --- a/nova/tests/functional/test_servers_resource_request.py +++ b/nova/tests/functional/test_servers_resource_request.py @@ -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 diff --git a/nova/tests/unit/accelerator/test_cyborg.py b/nova/tests/unit/accelerator/test_cyborg.py index 100f1a2115..2d814c74a1 100644 --- a/nova/tests/unit/accelerator/test_cyborg.py +++ b/nova/tests/unit/accelerator/test_cyborg.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/admin_only_action_common.py b/nova/tests/unit/api/openstack/compute/admin_only_action_common.py index 37fd1012b7..f332d9f32f 100644 --- a/nova/tests/unit/api/openstack/compute/admin_only_action_common.py +++ b/nova/tests/unit/api/openstack/compute/admin_only_action_common.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_admin_password.py b/nova/tests/unit/api/openstack/compute/test_admin_password.py index 90a4a2983b..67e4c743d5 100644 --- a/nova/tests/unit/api/openstack/compute/test_admin_password.py +++ b/nova/tests/unit/api/openstack/compute/test_admin_password.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_aggregates.py b/nova/tests/unit/api/openstack/compute/test_aggregates.py index fb096861eb..21d644f0be 100644 --- a/nova/tests/unit/api/openstack/compute/test_aggregates.py +++ b/nova/tests/unit/api/openstack/compute/test_aggregates.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py b/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py index 526cb6011d..e4719ea052 100644 --- a/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py +++ b/nova/tests/unit/api/openstack/compute/test_attach_interfaces.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_availability_zone.py b/nova/tests/unit/api/openstack/compute/test_availability_zone.py index f355eb436a..a408e0d1aa 100644 --- a/nova/tests/unit/api/openstack/compute/test_availability_zone.py +++ b/nova/tests/unit/api/openstack/compute/test_availability_zone.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py b/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py index 55a8b03216..c8ad907b10 100644 --- a/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py +++ b/nova/tests/unit/api/openstack/compute/test_baremetal_nodes.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_console_auth_tokens.py b/nova/tests/unit/api/openstack/compute/test_console_auth_tokens.py index 429096d51d..a1f3d1e63d 100644 --- a/nova/tests/unit/api/openstack/compute/test_console_auth_tokens.py +++ b/nova/tests/unit/api/openstack/compute/test_console_auth_tokens.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_console_output.py b/nova/tests/unit/api/openstack/compute/test_console_output.py index 1a76a445fc..a9dc830255 100644 --- a/nova/tests/unit/api/openstack/compute/test_console_output.py +++ b/nova/tests/unit/api/openstack/compute/test_console_output.py @@ -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 \ diff --git a/nova/tests/unit/api/openstack/compute/test_create_backup.py b/nova/tests/unit/api/openstack/compute/test_create_backup.py index f7280a5a37..4a9742177e 100644 --- a/nova/tests/unit/api/openstack/compute/test_create_backup.py +++ b/nova/tests/unit/api/openstack/compute/test_create_backup.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_deferred_delete.py b/nova/tests/unit/api/openstack/compute/test_deferred_delete.py index db6f774c51..8a1c8efd57 100644 --- a/nova/tests/unit/api/openstack/compute/test_deferred_delete.py +++ b/nova/tests/unit/api/openstack/compute/test_deferred_delete.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_disk_config.py b/nova/tests/unit/api/openstack/compute/test_disk_config.py index bf3be1d0a3..c5ee59722a 100644 --- a/nova/tests/unit/api/openstack/compute/test_disk_config.py +++ b/nova/tests/unit/api/openstack/compute/test_disk_config.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_evacuate.py b/nova/tests/unit/api/openstack/compute/test_evacuate.py index 6620d7a180..fb7f7662d8 100644 --- a/nova/tests/unit/api/openstack/compute/test_evacuate.py +++ b/nova/tests/unit/api/openstack/compute/test_evacuate.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_flavor_access.py b/nova/tests/unit/api/openstack/compute/test_flavor_access.py index 8c25a2efc2..0581a47c84 100644 --- a/nova/tests/unit/api/openstack/compute/test_flavor_access.py +++ b/nova/tests/unit/api/openstack/compute/test_flavor_access.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_flavor_manage.py b/nova/tests/unit/api/openstack/compute/test_flavor_manage.py index f8412c772c..948f255f34 100644 --- a/nova/tests/unit/api/openstack/compute/test_flavor_manage.py +++ b/nova/tests/unit/api/openstack/compute/test_flavor_manage.py @@ -14,8 +14,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_serialization import jsonutils import webob diff --git a/nova/tests/unit/api/openstack/compute/test_flavors.py b/nova/tests/unit/api/openstack/compute/test_flavors.py index 4390b32012..c7fbf5c468 100644 --- a/nova/tests/unit/api/openstack/compute/test_flavors.py +++ b/nova/tests/unit/api/openstack/compute/test_flavors.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_flavors_extra_specs.py b/nova/tests/unit/api/openstack/compute/test_flavors_extra_specs.py index e68bf7e306..8355ce59b5 100644 --- a/nova/tests/unit/api/openstack/compute/test_flavors_extra_specs.py +++ b/nova/tests/unit/api/openstack/compute/test_flavors_extra_specs.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_floating_ip_pools.py b/nova/tests/unit/api/openstack/compute/test_floating_ip_pools.py index e25302ee9a..71ca209672 100644 --- a/nova/tests/unit/api/openstack/compute/test_floating_ip_pools.py +++ b/nova/tests/unit/api/openstack/compute/test_floating_ip_pools.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_floating_ips.py b/nova/tests/unit/api/openstack/compute/test_floating_ips.py index 2cb89dfe76..7093c5a80d 100644 --- a/nova/tests/unit/api/openstack/compute/test_floating_ips.py +++ b/nova/tests/unit/api/openstack/compute/test_floating_ips.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_hosts.py b/nova/tests/unit/api/openstack/compute/test_hosts.py index 7adc698093..f1cdde2917 100644 --- a/nova/tests/unit/api/openstack/compute/test_hosts.py +++ b/nova/tests/unit/api/openstack/compute/test_hosts.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_hypervisors.py b/nova/tests/unit/api/openstack/compute/test_hypervisors.py index facc5389be..9b4bac1380 100644 --- a/nova/tests/unit/api/openstack/compute/test_hypervisors.py +++ b/nova/tests/unit/api/openstack/compute/test_hypervisors.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_image_metadata.py b/nova/tests/unit/api/openstack/compute/test_image_metadata.py index 2e1c26a712..4072d6f489 100644 --- a/nova/tests/unit/api/openstack/compute/test_image_metadata.py +++ b/nova/tests/unit/api/openstack/compute/test_image_metadata.py @@ -14,8 +14,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_serialization import jsonutils import webob diff --git a/nova/tests/unit/api/openstack/compute/test_images.py b/nova/tests/unit/api/openstack/compute/test_images.py index fad4fcb5a2..734e755dd5 100644 --- a/nova/tests/unit/api/openstack/compute/test_images.py +++ b/nova/tests/unit/api/openstack/compute/test_images.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_instance_actions.py b/nova/tests/unit/api/openstack/compute/test_instance_actions.py index 04e9ae443e..df13e1d89d 100644 --- a/nova/tests/unit/api/openstack/compute/test_instance_actions.py +++ b/nova/tests/unit/api/openstack/compute/test_instance_actions.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_keypairs.py b/nova/tests/unit/api/openstack/compute/test_keypairs.py index c6f59b615b..590639d5ed 100644 --- a/nova/tests/unit/api/openstack/compute/test_keypairs.py +++ b/nova/tests/unit/api/openstack/compute/test_keypairs.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_limits.py b/nova/tests/unit/api/openstack/compute/test_limits.py index 2c245dc4a8..f649079803 100644 --- a/nova/tests/unit/api/openstack/compute/test_limits.py +++ b/nova/tests/unit/api/openstack/compute/test_limits.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_lock_server.py b/nova/tests/unit/api/openstack/compute/test_lock_server.py index 3903ec7945..bf49bf2b73 100644 --- a/nova/tests/unit/api/openstack/compute/test_lock_server.py +++ b/nova/tests/unit/api/openstack/compute/test_lock_server.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_microversions.py b/nova/tests/unit/api/openstack/compute/test_microversions.py index c5b1ddb5e5..9f5dd90889 100644 --- a/nova/tests/unit/api/openstack/compute/test_microversions.py +++ b/nova/tests/unit/api/openstack/compute/test_microversions.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_migrate_server.py b/nova/tests/unit/api/openstack/compute/test_migrate_server.py index 683759eccc..407cdf7f8e 100644 --- a/nova/tests/unit/api/openstack/compute/test_migrate_server.py +++ b/nova/tests/unit/api/openstack/compute/test_migrate_server.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_migrations.py b/nova/tests/unit/api/openstack/compute/test_migrations.py index a06d395bea..19bc42a9de 100644 --- a/nova/tests/unit/api/openstack/compute/test_migrations.py +++ b/nova/tests/unit/api/openstack/compute/test_migrations.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_multinic.py b/nova/tests/unit/api/openstack/compute/test_multinic.py index ceaaebf373..17a872fed2 100644 --- a/nova/tests/unit/api/openstack/compute/test_multinic.py +++ b/nova/tests/unit/api/openstack/compute/test_multinic.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_quota_classes.py b/nova/tests/unit/api/openstack/compute/test_quota_classes.py index d501412803..463f8344c0 100644 --- a/nova/tests/unit/api/openstack/compute/test_quota_classes.py +++ b/nova/tests/unit/api/openstack/compute/test_quota_classes.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_quotas.py b/nova/tests/unit/api/openstack/compute/test_quotas.py index 6cb8d9c7ad..8c2b67d3a8 100644 --- a/nova/tests/unit/api/openstack/compute/test_quotas.py +++ b/nova/tests/unit/api/openstack/compute/test_quotas.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_remote_consoles.py b/nova/tests/unit/api/openstack/compute/test_remote_consoles.py index 8d1dfa9a40..bd09307567 100644 --- a/nova/tests/unit/api/openstack/compute/test_remote_consoles.py +++ b/nova/tests/unit/api/openstack/compute/test_remote_consoles.py @@ -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 diff --git a/nova/tests/unit/api/openstack/compute/test_rescue.py b/nova/tests/unit/api/openstack/compute/test_rescue.py index 28b8217d1a..8a87f52222 100644 --- a/nova/tests/unit/api/openstack/compute/test_rescue.py +++ b/nova/tests/unit/api/openstack/compute/test_rescue.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import ddt from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/api/openstack/compute/test_security_groups.py b/nova/tests/unit/api/openstack/compute/test_security_groups.py index 71cdcbc871..4a85a9997d 100644 --- a/nova/tests/unit/api/openstack/compute/test_security_groups.py +++ b/nova/tests/unit/api/openstack/compute/test_security_groups.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from neutronclient.common import exceptions as n_exc +from unittest import mock + from oslo_config import cfg from oslo_serialization import jsonutils from oslo_utils import encodeutils diff --git a/nova/tests/unit/api/openstack/compute/test_server_actions.py b/nova/tests/unit/api/openstack/compute/test_server_actions.py index d07924abe8..4c5fd399e6 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_actions.py +++ b/nova/tests/unit/api/openstack/compute/test_server_actions.py @@ -13,9 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt import fixtures -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import uuidutils import webob diff --git a/nova/tests/unit/api/openstack/compute/test_server_diagnostics.py b/nova/tests/unit/api/openstack/compute/test_server_diagnostics.py index d215f3e903..12d8bbb318 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_diagnostics.py +++ b/nova/tests/unit/api/openstack/compute/test_server_diagnostics.py @@ -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 from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/api/openstack/compute/test_server_external_events.py b/nova/tests/unit/api/openstack/compute/test_server_external_events.py index 647f468f37..e366d0acdd 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_external_events.py +++ b/nova/tests/unit/api/openstack/compute/test_server_external_events.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import fixtures as fx -import mock from oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import server_external_events \ diff --git a/nova/tests/unit/api/openstack/compute/test_server_group_quotas.py b/nova/tests/unit/api/openstack/compute/test_server_group_quotas.py index a0404baffc..8d0ba37f92 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_group_quotas.py +++ b/nova/tests/unit/api/openstack/compute/test_server_group_quotas.py @@ -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 oslo_limit import fixture as limit_fixture from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/api/openstack/compute/test_server_groups.py b/nova/tests/unit/api/openstack/compute/test_server_groups.py index a0d1712343..636682a6b7 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_groups.py +++ b/nova/tests/unit/api/openstack/compute/test_server_groups.py @@ -14,7 +14,8 @@ # under the License. import copy -import mock +from unittest import mock + from oslo_utils.fixture import uuidsentinel from oslo_utils import uuidutils import webob diff --git a/nova/tests/unit/api/openstack/compute/test_server_metadata.py b/nova/tests/unit/api/openstack/compute/test_server_metadata.py index a454597305..9b420dde17 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_metadata.py +++ b/nova/tests/unit/api/openstack/compute/test_server_metadata.py @@ -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 oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/api/openstack/compute/test_server_migrations.py b/nova/tests/unit/api/openstack/compute/test_server_migrations.py index 8d798d434c..c5d8556751 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_migrations.py +++ b/nova/tests/unit/api/openstack/compute/test_server_migrations.py @@ -15,8 +15,8 @@ import copy import datetime +from unittest import mock -import mock from oslo_utils.fixture import uuidsentinel as uuids import webob diff --git a/nova/tests/unit/api/openstack/compute/test_server_password.py b/nova/tests/unit/api/openstack/compute/test_server_password.py index e34ceb90e9..2751eee709 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_password.py +++ b/nova/tests/unit/api/openstack/compute/test_server_password.py @@ -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 server_password \ as server_password_v21 diff --git a/nova/tests/unit/api/openstack/compute/test_server_reset_state.py b/nova/tests/unit/api/openstack/compute/test_server_reset_state.py index 3462cf21ac..3a0c9ca1e2 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_reset_state.py +++ b/nova/tests/unit/api/openstack/compute/test_server_reset_state.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_utils import uuidutils import webob diff --git a/nova/tests/unit/api/openstack/compute/test_server_start_stop.py b/nova/tests/unit/api/openstack/compute/test_server_start_stop.py index 60d12d0c43..f604652622 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_start_stop.py +++ b/nova/tests/unit/api/openstack/compute/test_server_start_stop.py @@ -12,7 +12,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 diff --git a/nova/tests/unit/api/openstack/compute/test_server_tags.py b/nova/tests/unit/api/openstack/compute/test_server_tags.py index b121c75c3a..4e4609d778 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_tags.py +++ b/nova/tests/unit/api/openstack/compute/test_server_tags.py @@ -10,7 +10,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.compute import server_tags diff --git a/nova/tests/unit/api/openstack/compute/test_server_topology.py b/nova/tests/unit/api/openstack/compute/test_server_topology.py index 3d8f6dc908..63d5f7a5c1 100644 --- a/nova/tests/unit/api/openstack/compute/test_server_topology.py +++ b/nova/tests/unit/api/openstack/compute/test_server_topology.py @@ -11,7 +11,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 webob import exc diff --git a/nova/tests/unit/api/openstack/compute/test_servers.py b/nova/tests/unit/api/openstack/compute/test_servers.py index 63115659af..fc85e9c4e9 100644 --- a/nova/tests/unit/api/openstack/compute/test_servers.py +++ b/nova/tests/unit/api/openstack/compute/test_servers.py @@ -17,13 +17,14 @@ import collections import copy import datetime +from unittest import mock + import ddt import functools from urllib import parse as urlparse import fixtures import iso8601 -import mock from oslo_policy import policy as oslo_policy from oslo_serialization import base64 from oslo_serialization import jsonutils diff --git a/nova/tests/unit/api/openstack/compute/test_services.py b/nova/tests/unit/api/openstack/compute/test_services.py index 5d83bc5a91..f237acc15a 100644 --- a/nova/tests/unit/api/openstack/compute/test_services.py +++ b/nova/tests/unit/api/openstack/compute/test_services.py @@ -14,9 +14,9 @@ import copy import datetime +from unittest import mock from keystoneauth1 import exceptions as ks_exc -import mock from oslo_utils import fixture as utils_fixture from oslo_utils.fixture import uuidsentinel import webob.exc diff --git a/nova/tests/unit/api/openstack/compute/test_shelve.py b/nova/tests/unit/api/openstack/compute/test_shelve.py index c361d0b9ea..e172380ec3 100644 --- a/nova/tests/unit/api/openstack/compute/test_shelve.py +++ b/nova/tests/unit/api/openstack/compute/test_shelve.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -import fixtures -import mock +from unittest import mock import ddt +import fixtures from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids import webob diff --git a/nova/tests/unit/api/openstack/compute/test_simple_tenant_usage.py b/nova/tests/unit/api/openstack/compute/test_simple_tenant_usage.py index 5794fdf061..a7dcfae558 100644 --- a/nova/tests/unit/api/openstack/compute/test_simple_tenant_usage.py +++ b/nova/tests/unit/api/openstack/compute/test_simple_tenant_usage.py @@ -14,8 +14,8 @@ # under the License. import datetime +from unittest import mock -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils import webob diff --git a/nova/tests/unit/api/openstack/compute/test_snapshots.py b/nova/tests/unit/api/openstack/compute/test_snapshots.py index b23ed50865..2e133506a3 100644 --- a/nova/tests/unit/api/openstack/compute/test_snapshots.py +++ b/nova/tests/unit/api/openstack/compute/test_snapshots.py @@ -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 volumes as volumes_v21 diff --git a/nova/tests/unit/api/openstack/compute/test_suspend_server.py b/nova/tests/unit/api/openstack/compute/test_suspend_server.py index 6eeb2b4549..a44297362c 100644 --- a/nova/tests/unit/api/openstack/compute/test_suspend_server.py +++ b/nova/tests/unit/api/openstack/compute/test_suspend_server.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from oslo_utils.fixture import uuidsentinel as uuids import webob diff --git a/nova/tests/unit/api/openstack/compute/test_tenant_networks.py b/nova/tests/unit/api/openstack/compute/test_tenant_networks.py index d05c85c508..c6de561b11 100644 --- a/nova/tests/unit/api/openstack/compute/test_tenant_networks.py +++ b/nova/tests/unit/api/openstack/compute/test_tenant_networks.py @@ -13,8 +13,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_config import cfg from oslo_utils.fixture import uuidsentinel as uuids import webob diff --git a/nova/tests/unit/api/openstack/compute/test_volumes.py b/nova/tests/unit/api/openstack/compute/test_volumes.py index a24c104c93..660f70bfeb 100644 --- a/nova/tests/unit/api/openstack/compute/test_volumes.py +++ b/nova/tests/unit/api/openstack/compute/test_volumes.py @@ -15,10 +15,10 @@ # under the License. import datetime +from unittest import mock import urllib import fixtures -import mock from oslo_serialization import jsonutils from oslo_utils import encodeutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/api/openstack/test_common.py b/nova/tests/unit/api/openstack/test_common.py index 4666413e27..7fe98bd52e 100644 --- a/nova/tests/unit/api/openstack/test_common.py +++ b/nova/tests/unit/api/openstack/test_common.py @@ -17,7 +17,8 @@ Test suites for 'common' code used throughout the OpenStack HTTP API. """ -import mock +from unittest import mock + from testtools import matchers import webob import webob.exc diff --git a/nova/tests/unit/api/openstack/test_faults.py b/nova/tests/unit/api/openstack/test_faults.py index 1bd56a87c5..c7dd5c0a9d 100644 --- a/nova/tests/unit/api/openstack/test_faults.py +++ b/nova/tests/unit/api/openstack/test_faults.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_serialization import jsonutils import webob import webob.dec diff --git a/nova/tests/unit/api/openstack/test_requestlog.py b/nova/tests/unit/api/openstack/test_requestlog.py index 0ea91439cc..7e79e1b079 100644 --- a/nova/tests/unit/api/openstack/test_requestlog.py +++ b/nova/tests/unit/api/openstack/test_requestlog.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import fixtures as fx import testtools diff --git a/nova/tests/unit/api/openstack/test_wsgi.py b/nova/tests/unit/api/openstack/test_wsgi.py index e0cf8f6fd8..76554e1fcb 100644 --- a/nova/tests/unit/api/openstack/test_wsgi.py +++ b/nova/tests/unit/api/openstack/test_wsgi.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_serialization import jsonutils import testscenarios import webob diff --git a/nova/tests/unit/api/openstack/test_wsgi_app.py b/nova/tests/unit/api/openstack/test_wsgi_app.py index 247886b9dd..94e2fe5cb1 100644 --- a/nova/tests/unit/api/openstack/test_wsgi_app.py +++ b/nova/tests/unit/api/openstack/test_wsgi_app.py @@ -11,9 +11,9 @@ # under the License. import tempfile +from unittest import mock import fixtures -import mock from oslo_config import fixture as config_fixture from oslotest import base diff --git a/nova/tests/unit/api/test_auth.py b/nova/tests/unit/api/test_auth.py index 3be245b90e..3bc5f51b04 100644 --- a/nova/tests/unit/api/test_auth.py +++ b/nova/tests/unit/api/test_auth.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_middleware import request_id from oslo_serialization import jsonutils import webob diff --git a/nova/tests/unit/api/test_wsgi.py b/nova/tests/unit/api/test_wsgi.py index b2701dc723..b8f215c730 100644 --- a/nova/tests/unit/api/test_wsgi.py +++ b/nova/tests/unit/api/test_wsgi.py @@ -20,8 +20,8 @@ Test WSGI basics and provide some helper functions for other WSGI tests. """ import sys +from unittest import mock -import mock import routes import webob diff --git a/nova/tests/unit/cmd/test_baseproxy.py b/nova/tests/unit/cmd/test_baseproxy.py index 34f911cd83..25f3905f24 100644 --- a/nova/tests/unit/cmd/test_baseproxy.py +++ b/nova/tests/unit/cmd/test_baseproxy.py @@ -13,9 +13,9 @@ # limitations under the License. from io import StringIO +from unittest import mock import fixtures -import mock from oslo_log import log as logging from oslo_reports import guru_meditation_report as gmr diff --git a/nova/tests/unit/cmd/test_common.py b/nova/tests/unit/cmd/test_common.py index cabb54f9d4..a32073c297 100644 --- a/nova/tests/unit/cmd/test_common.py +++ b/nova/tests/unit/cmd/test_common.py @@ -19,9 +19,9 @@ from io import StringIO import sys +from unittest import mock import fixtures -import mock from nova.cmd import common as cmd_common from nova import exception diff --git a/nova/tests/unit/cmd/test_compute.py b/nova/tests/unit/cmd/test_compute.py index acfcea50d2..e465b026aa 100644 --- a/nova/tests/unit/cmd/test_compute.py +++ b/nova/tests/unit/cmd/test_compute.py @@ -13,8 +13,8 @@ # limitations under the License. import contextlib +from unittest import mock -import mock from nova.cmd import compute from nova import context diff --git a/nova/tests/unit/cmd/test_manage.py b/nova/tests/unit/cmd/test_manage.py index 5be0f8edac..10c1a77c94 100644 --- a/nova/tests/unit/cmd/test_manage.py +++ b/nova/tests/unit/cmd/test_manage.py @@ -17,11 +17,11 @@ import datetime from io import StringIO import sys import textwrap +from unittest import mock import warnings import ddt import fixtures -import mock from oslo_db import exception as db_exc from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel diff --git a/nova/tests/unit/cmd/test_nova_api.py b/nova/tests/unit/cmd/test_nova_api.py index f13712eabd..a4f7d82105 100644 --- a/nova/tests/unit/cmd/test_nova_api.py +++ b/nova/tests/unit/cmd/test_nova_api.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.cmd import api from nova import config diff --git a/nova/tests/unit/cmd/test_policy.py b/nova/tests/unit/cmd/test_policy.py index 20cc87da13..60e8e32c75 100644 --- a/nova/tests/unit/cmd/test_policy.py +++ b/nova/tests/unit/cmd/test_policy.py @@ -18,9 +18,9 @@ """ from io import StringIO +from unittest import mock import fixtures -import mock from nova.cmd import policy import nova.conf diff --git a/nova/tests/unit/cmd/test_scheduler.py b/nova/tests/unit/cmd/test_scheduler.py index e207c7343f..2927492abc 100644 --- a/nova/tests/unit/cmd/test_scheduler.py +++ b/nova/tests/unit/cmd/test_scheduler.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.cmd import scheduler from nova import config diff --git a/nova/tests/unit/cmd/test_status.py b/nova/tests/unit/cmd/test_status.py index b61da4ae9f..4f2510438d 100644 --- a/nova/tests/unit/cmd/test_status.py +++ b/nova/tests/unit/cmd/test_status.py @@ -21,10 +21,9 @@ Unit tests for the nova-status CLI interfaces. # PlacementFixture, which is only available in functional tests. from io import StringIO +from unittest import mock import fixtures -import mock - from keystoneauth1 import exceptions as ks_exc from keystoneauth1 import loading as keystone from keystoneauth1 import session diff --git a/nova/tests/unit/compute/monitors/cpu/test_virt_driver.py b/nova/tests/unit/compute/monitors/cpu/test_virt_driver.py index aed34ea30c..a563a7e346 100644 --- a/nova/tests/unit/compute/monitors/cpu/test_virt_driver.py +++ b/nova/tests/unit/compute/monitors/cpu/test_virt_driver.py @@ -15,7 +15,7 @@ """Tests for Compute Driver CPU resource monitor.""" -import mock +from unittest import mock from nova.compute.monitors.cpu import virt_driver from nova import objects diff --git a/nova/tests/unit/compute/monitors/test_monitors.py b/nova/tests/unit/compute/monitors/test_monitors.py index 34b4a34d20..d43f90206c 100644 --- a/nova/tests/unit/compute/monitors/test_monitors.py +++ b/nova/tests/unit/compute/monitors/test_monitors.py @@ -15,7 +15,7 @@ """Tests for resource monitors.""" -import mock +from unittest import mock from nova.compute import monitors from nova import test diff --git a/nova/tests/unit/compute/test_api.py b/nova/tests/unit/compute/test_api.py index b2b01772b5..38db08d952 100644 --- a/nova/tests/unit/compute/test_api.py +++ b/nova/tests/unit/compute/test_api.py @@ -15,11 +15,11 @@ import contextlib import datetime +from unittest import mock import ddt import fixtures import iso8601 -import mock import os_traits as ot from oslo_limit import exception as limit_exceptions from oslo_messaging import exceptions as oslo_exceptions diff --git a/nova/tests/unit/compute/test_claims.py b/nova/tests/unit/compute/test_claims.py index 8997511e73..9ef3999441 100644 --- a/nova/tests/unit/compute/test_claims.py +++ b/nova/tests/unit/compute/test_claims.py @@ -15,9 +15,9 @@ """Tests for resource tracker claims.""" +from unittest import mock import uuid -import mock from nova.compute import claims from nova import context diff --git a/nova/tests/unit/compute/test_compute.py b/nova/tests/unit/compute/test_compute.py index 5be699ee81..f8c87854d9 100644 --- a/nova/tests/unit/compute/test_compute.py +++ b/nova/tests/unit/compute/test_compute.py @@ -22,10 +22,10 @@ import fixtures as std_fixtures from itertools import chain import operator import sys +from unittest import mock from castellan import key_manager import ddt -import mock from neutronclient.common import exceptions as neutron_exceptions from oslo_log import log as logging import oslo_messaging as messaging diff --git a/nova/tests/unit/compute/test_compute_mgr.py b/nova/tests/unit/compute/test_compute_mgr.py index 645d82b4bf..186ead2a28 100644 --- a/nova/tests/unit/compute/test_compute_mgr.py +++ b/nova/tests/unit/compute/test_compute_mgr.py @@ -17,6 +17,7 @@ import copy import datetime import fixtures as std_fixtures import time +from unittest import mock from cinderclient import exceptions as cinder_exception from cursive import exception as cursive_exception @@ -24,7 +25,6 @@ import ddt from eventlet import event as eventlet_event from eventlet import timeout as eventlet_timeout from keystoneauth1 import exceptions as keystone_exception -import mock import netaddr from oslo_log import log as logging import oslo_messaging as messaging diff --git a/nova/tests/unit/compute/test_host_api.py b/nova/tests/unit/compute/test_host_api.py index e4c310deb0..7f9e862057 100644 --- a/nova/tests/unit/compute/test_host_api.py +++ b/nova/tests/unit/compute/test_host_api.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import fixtures -import mock import oslo_messaging as messaging from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/compute/test_instance_list.py b/nova/tests/unit/compute/test_instance_list.py index e6e195e9cc..6544ddc801 100644 --- a/nova/tests/unit/compute/test_instance_list.py +++ b/nova/tests/unit/compute/test_instance_list.py @@ -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 instance_list diff --git a/nova/tests/unit/compute/test_keypairs.py b/nova/tests/unit/compute/test_keypairs.py index b0d6eb46dc..8822cb4522 100644 --- a/nova/tests/unit/compute/test_keypairs.py +++ b/nova/tests/unit/compute/test_keypairs.py @@ -14,7 +14,8 @@ # under the License. """Tests for keypair API.""" -import mock +from unittest import mock + from oslo_concurrency import processutils from oslo_config import cfg from oslo_limit import fixture as limit_fixture diff --git a/nova/tests/unit/compute/test_multi_cell_list.py b/nova/tests/unit/compute/test_multi_cell_list.py index 6bb67a76b8..5906f69de2 100644 --- a/nova/tests/unit/compute/test_multi_cell_list.py +++ b/nova/tests/unit/compute/test_multi_cell_list.py @@ -13,7 +13,8 @@ from contextlib import contextmanager import copy import datetime -import mock +from unittest import mock + from oslo_utils.fixture import uuidsentinel as uuids from nova.compute import multi_cell_list diff --git a/nova/tests/unit/compute/test_resource_tracker.py b/nova/tests/unit/compute/test_resource_tracker.py index 6a87bee436..4295febe2e 100644 --- a/nova/tests/unit/compute/test_resource_tracker.py +++ b/nova/tests/unit/compute/test_resource_tracker.py @@ -12,9 +12,9 @@ import copy import datetime +from unittest import mock from keystoneauth1 import exceptions as ks_exc -import mock import os_resource_classes as orc import os_traits from oslo_config import cfg diff --git a/nova/tests/unit/compute/test_rpcapi.py b/nova/tests/unit/compute/test_rpcapi.py index f0e560a3de..541cc1012e 100644 --- a/nova/tests/unit/compute/test_rpcapi.py +++ b/nova/tests/unit/compute/test_rpcapi.py @@ -16,7 +16,8 @@ Unit Tests for nova.compute.rpcapi """ -import mock +from unittest import mock + from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/compute/test_shelve.py b/nova/tests/unit/compute/test_shelve.py index d6ccc712b9..c939b927f1 100644 --- a/nova/tests/unit/compute/test_shelve.py +++ b/nova/tests/unit/compute/test_shelve.py @@ -10,11 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import eventlet from oslo_utils import fixture as utils_fixture from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils -from unittest import mock from nova.compute import api as compute_api from nova.compute import claims diff --git a/nova/tests/unit/compute/test_utils.py b/nova/tests/unit/compute/test_utils.py index 6c3cbc1b57..848050d769 100644 --- a/nova/tests/unit/compute/test_utils.py +++ b/nova/tests/unit/compute/test_utils.py @@ -19,8 +19,8 @@ import copy import datetime import string +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import uuidutils diff --git a/nova/tests/unit/compute/test_virtapi.py b/nova/tests/unit/compute/test_virtapi.py index d6dc8f125b..15d004a816 100644 --- a/nova/tests/unit/compute/test_virtapi.py +++ b/nova/tests/unit/compute/test_virtapi.py @@ -13,9 +13,9 @@ # under the License. import collections +from unittest import mock import eventlet.timeout -import mock import os_traits from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/conductor/tasks/test_base.py b/nova/tests/unit/conductor/tasks/test_base.py index a7151c4cd0..cf9e8f9cfd 100644 --- a/nova/tests/unit/conductor/tasks/test_base.py +++ b/nova/tests/unit/conductor/tasks/test_base.py @@ -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.tasks import base from nova import test diff --git a/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py b/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py index ec07e6f55f..c4b6c217b6 100644 --- a/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py +++ b/nova/tests/unit/conductor/tasks/test_cross_cell_migrate.py @@ -11,8 +11,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_messaging import exceptions as messaging_exceptions from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/conductor/tasks/test_live_migrate.py b/nova/tests/unit/conductor/tasks/test_live_migrate.py index dd4ee7c3fe..de15be28bd 100644 --- a/nova/tests/unit/conductor/tasks/test_live_migrate.py +++ b/nova/tests/unit/conductor/tasks/test_live_migrate.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + import oslo_messaging as messaging from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/conductor/tasks/test_migrate.py b/nova/tests/unit/conductor/tasks/test_migrate.py index 145e54f884..46cb033c5c 100644 --- a/nova/tests/unit/conductor/tasks/test_migrate.py +++ b/nova/tests/unit/conductor/tasks/test_migrate.py @@ -10,7 +10,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 diff --git a/nova/tests/unit/conductor/test_conductor.py b/nova/tests/unit/conductor/test_conductor.py index 2e3725223e..6f5331cc48 100644 --- a/nova/tests/unit/conductor/test_conductor.py +++ b/nova/tests/unit/conductor/test_conductor.py @@ -16,8 +16,8 @@ """Tests for the conductor service.""" import copy +from unittest import mock -import mock from oslo_db import exception as db_exc from oslo_limit import exception as limit_exceptions import oslo_messaging as messaging diff --git a/nova/tests/unit/console/rfb/test_auth.py b/nova/tests/unit/console/rfb/test_auth.py index c4026b6637..1d66b2684f 100644 --- a/nova/tests/unit/console/rfb/test_auth.py +++ b/nova/tests/unit/console/rfb/test_auth.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.console.rfb import auth from nova.console.rfb import authnone diff --git a/nova/tests/unit/console/rfb/test_authnone.py b/nova/tests/unit/console/rfb/test_authnone.py index e628106e3b..3ca44dce89 100644 --- a/nova/tests/unit/console/rfb/test_authnone.py +++ b/nova/tests/unit/console/rfb/test_authnone.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.console.rfb import auth from nova.console.rfb import authnone diff --git a/nova/tests/unit/console/rfb/test_authvencrypt.py b/nova/tests/unit/console/rfb/test_authvencrypt.py index f7fc31939e..de9bccb44a 100644 --- a/nova/tests/unit/console/rfb/test_authvencrypt.py +++ b/nova/tests/unit/console/rfb/test_authvencrypt.py @@ -14,8 +14,8 @@ import ssl import struct +from unittest import mock -import mock from nova.console.rfb import auth from nova.console.rfb import authvencrypt diff --git a/nova/tests/unit/console/securityproxy/test_rfb.py b/nova/tests/unit/console/securityproxy/test_rfb.py index 3eb8ba6acf..17cf8f7c57 100644 --- a/nova/tests/unit/console/securityproxy/test_rfb.py +++ b/nova/tests/unit/console/securityproxy/test_rfb.py @@ -15,7 +15,7 @@ """Tests the Console Security Proxy Framework.""" -import mock +from unittest import mock from nova.console.rfb import auth from nova.console.rfb import authnone diff --git a/nova/tests/unit/console/test_serial.py b/nova/tests/unit/console/test_serial.py index bc87ca6ca2..44d88e6e83 100644 --- a/nova/tests/unit/console/test_serial.py +++ b/nova/tests/unit/console/test_serial.py @@ -15,8 +15,7 @@ """Tests for Serial Console.""" import socket - -import mock +from unittest import mock from nova.console import serial from nova import exception diff --git a/nova/tests/unit/console/test_websocketproxy.py b/nova/tests/unit/console/test_websocketproxy.py index 1833d3a0c9..30f3502bc8 100644 --- a/nova/tests/unit/console/test_websocketproxy.py +++ b/nova/tests/unit/console/test_websocketproxy.py @@ -17,8 +17,8 @@ import copy import io import socket +from unittest import mock -import mock from oslo_utils.fixture import uuidsentinel as uuids import nova.conf diff --git a/nova/tests/unit/db/api/test_api.py b/nova/tests/unit/db/api/test_api.py index 251407612f..6113791a8e 100644 --- a/nova/tests/unit/db/api/test_api.py +++ b/nova/tests/unit/db/api/test_api.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.db.api import api as db_api from nova import test diff --git a/nova/tests/unit/db/api/test_migrations.py b/nova/tests/unit/db/api/test_migrations.py index 1b14d569db..3b9b17aab2 100644 --- a/nova/tests/unit/db/api/test_migrations.py +++ b/nova/tests/unit/db/api/test_migrations.py @@ -21,10 +21,11 @@ test will then use that DB and username/password combo to run the tests. Refer to the 'tools/test-setup.sh' for an example of how to configure this. """ +from unittest import mock + from alembic import command as alembic_api from alembic import script as alembic_script from migrate.versioning import api as migrate_api -import mock from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import test_fixtures from oslo_db.sqlalchemy import test_migrations diff --git a/nova/tests/unit/db/main/test_api.py b/nova/tests/unit/db/main/test_api.py index a984b7234d..791b93808b 100644 --- a/nova/tests/unit/db/main/test_api.py +++ b/nova/tests/unit/db/main/test_api.py @@ -18,10 +18,10 @@ import copy import datetime +from unittest import mock from dateutil import parser as dateutil_parser import iso8601 -import mock import netaddr from oslo_db import api as oslo_db_api from oslo_db import exception as db_exc diff --git a/nova/tests/unit/db/main/test_migrations.py b/nova/tests/unit/db/main/test_migrations.py index f5ce3697b3..2b3f01b704 100644 --- a/nova/tests/unit/db/main/test_migrations.py +++ b/nova/tests/unit/db/main/test_migrations.py @@ -25,11 +25,12 @@ test will then use that DB and username/password combo to run the tests. Refer to the 'tools/test-setup.sh' for an example of how to configure this. """ +from unittest import mock + from alembic import command as alembic_api from alembic import script as alembic_script import fixtures from migrate.versioning import api as migrate_api -import mock from oslo_db.sqlalchemy import enginefacade from oslo_db.sqlalchemy import test_fixtures from oslo_db.sqlalchemy import test_migrations diff --git a/nova/tests/unit/db/test_migration.py b/nova/tests/unit/db/test_migration.py index ca9b5c0c4c..ca86f6347c 100644 --- a/nova/tests/unit/db/test_migration.py +++ b/nova/tests/unit/db/test_migration.py @@ -14,12 +14,12 @@ import glob import os +from unittest import mock import urllib from alembic.runtime import migration as alembic_migration from migrate import exceptions as migrate_exceptions from migrate.versioning import api as migrate_api -import mock from nova.db.api import api as api_db_api from nova.db.main import api as main_db_api diff --git a/nova/tests/unit/fixtures/test_libvirt.py b/nova/tests/unit/fixtures/test_libvirt.py index eab9c54a13..448f8f6720 100644 --- a/nova/tests/unit/fixtures/test_libvirt.py +++ b/nova/tests/unit/fixtures/test_libvirt.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from lxml import etree -import mock from oslo_utils import uuidutils from nova.objects import fields as obj_fields diff --git a/nova/tests/unit/image/test_glance.py b/nova/tests/unit/image/test_glance.py index 4f35f060e4..935a271d44 100644 --- a/nova/tests/unit/image/test_glance.py +++ b/nova/tests/unit/image/test_glance.py @@ -18,6 +18,7 @@ import copy import datetime import io from io import StringIO +from unittest import mock import urllib.parse as urlparse import cryptography @@ -28,7 +29,6 @@ import glanceclient.exc from glanceclient.v1 import images from glanceclient.v2 import schemas from keystoneauth1 import loading as ks_loading -import mock from oslo_utils.fixture import uuidsentinel as uuids import testtools diff --git a/nova/tests/unit/limit/test_local.py b/nova/tests/unit/limit/test_local.py index 4dd321b757..8bf163d69f 100644 --- a/nova/tests/unit/limit/test_local.py +++ b/nova/tests/unit/limit/test_local.py @@ -13,8 +13,7 @@ # under the License. import copy - -import mock +from unittest import mock from oslo_config import cfg from oslo_limit import exception as limit_exceptions diff --git a/nova/tests/unit/limit/test_placement.py b/nova/tests/unit/limit/test_placement.py index cfb6ce36b4..3640890c74 100644 --- a/nova/tests/unit/limit/test_placement.py +++ b/nova/tests/unit/limit/test_placement.py @@ -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_limit import exception as limit_exceptions diff --git a/nova/tests/unit/network/test_neutron.py b/nova/tests/unit/network/test_neutron.py index ad987dad90..b82bf5349f 100644 --- a/nova/tests/unit/network/test_neutron.py +++ b/nova/tests/unit/network/test_neutron.py @@ -16,11 +16,11 @@ import collections import copy +from unittest import mock from keystoneauth1.fixture import V2Token from keystoneauth1 import loading as ks_loading from keystoneauth1 import service_token -import mock from neutronclient.common import exceptions from neutronclient.v2_0 import client from oslo_config import cfg diff --git a/nova/tests/unit/network/test_security_group.py b/nova/tests/unit/network/test_security_group.py index b0bde1d9a2..a76dd4bf3c 100644 --- a/nova/tests/unit/network/test_security_group.py +++ b/nova/tests/unit/network/test_security_group.py @@ -13,10 +13,11 @@ # License for the specific language governing permissions and limitations # under the License. # -import mock from neutronclient.common import exceptions as n_exc from neutronclient.neutron import v2_0 as neutronv20 from neutronclient.v2_0 import client +from unittest import mock + from oslo_utils.fixture import uuidsentinel as uuids from nova import context diff --git a/nova/tests/unit/notifications/objects/test_flavor.py b/nova/tests/unit/notifications/objects/test_flavor.py index 41fc8a36c3..e3cb9ec4c3 100644 --- a/nova/tests/unit/notifications/objects/test_flavor.py +++ b/nova/tests/unit/notifications/objects/test_flavor.py @@ -11,8 +11,8 @@ # under the License. import copy +from unittest import mock -import mock from nova import context from nova.notifications.objects import flavor as flavor_notification diff --git a/nova/tests/unit/notifications/objects/test_instance.py b/nova/tests/unit/notifications/objects/test_instance.py index c2b7315587..8735e972dc 100644 --- a/nova/tests/unit/notifications/objects/test_instance.py +++ b/nova/tests/unit/notifications/objects/test_instance.py @@ -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 timeutils diff --git a/nova/tests/unit/notifications/objects/test_notification.py b/nova/tests/unit/notifications/objects/test_notification.py index 3d9eeece8e..4b6869effb 100644 --- a/nova/tests/unit/notifications/objects/test_notification.py +++ b/nova/tests/unit/notifications/objects/test_notification.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. import collections +from unittest import mock -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils from oslo_versionedobjects import fixture diff --git a/nova/tests/unit/notifications/objects/test_service.py b/nova/tests/unit/notifications/objects/test_service.py index 6f0f5c7f7a..297dcac56f 100644 --- a/nova/tests/unit/notifications/objects/test_service.py +++ b/nova/tests/unit/notifications/objects/test_service.py @@ -14,8 +14,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_utils import timeutils from nova import context diff --git a/nova/tests/unit/notifications/test_base.py b/nova/tests/unit/notifications/test_base.py index 3ee2e36ddc..c0468ec64d 100644 --- a/nova/tests/unit/notifications/test_base.py +++ b/nova/tests/unit/notifications/test_base.py @@ -13,9 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. import datetime +from unittest import mock from keystoneauth1 import exceptions as ks_exc -import mock from oslo_utils.fixture import uuidsentinel as uuids from nova import context as nova_context diff --git a/nova/tests/unit/objects/test_aggregate.py b/nova/tests/unit/objects/test_aggregate.py index bdb14f72ad..3f01c9613d 100644 --- a/nova/tests/unit/objects/test_aggregate.py +++ b/nova/tests/unit/objects/test_aggregate.py @@ -12,7 +12,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 timeutils diff --git a/nova/tests/unit/objects/test_block_device.py b/nova/tests/unit/objects/test_block_device.py index 80c9e9a1fa..ad43bed8bf 100644 --- a/nova/tests/unit/objects/test_block_device.py +++ b/nova/tests/unit/objects/test_block_device.py @@ -12,7 +12,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 import context diff --git a/nova/tests/unit/objects/test_build_request.py b/nova/tests/unit/objects/test_build_request.py index 2b60888c5d..a55ab34008 100644 --- a/nova/tests/unit/objects/test_build_request.py +++ b/nova/tests/unit/objects/test_build_request.py @@ -10,7 +10,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 from oslo_versionedobjects import base as o_vo_base diff --git a/nova/tests/unit/objects/test_cell_mapping.py b/nova/tests/unit/objects/test_cell_mapping.py index 3182269cc5..936793294b 100644 --- a/nova/tests/unit/objects/test_cell_mapping.py +++ b/nova/tests/unit/objects/test_cell_mapping.py @@ -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 diff --git a/nova/tests/unit/objects/test_compute_node.py b/nova/tests/unit/objects/test_compute_node.py index 297edfbd55..1964117fd6 100644 --- a/nova/tests/unit/objects/test_compute_node.py +++ b/nova/tests/unit/objects/test_compute_node.py @@ -13,8 +13,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 diff --git a/nova/tests/unit/objects/test_console_auth_token.py b/nova/tests/unit/objects/test_console_auth_token.py index 9c92e798b0..9a0901e12a 100644 --- a/nova/tests/unit/objects/test_console_auth_token.py +++ b/nova/tests/unit/objects/test_console_auth_token.py @@ -14,7 +14,7 @@ # under the License. import copy -import mock +from unittest import mock import urllib.parse as urlparse from oslo_db.exception import DBDuplicateEntry diff --git a/nova/tests/unit/objects/test_ec2.py b/nova/tests/unit/objects/test_ec2.py index 8261fd6173..55230a7599 100644 --- a/nova/tests/unit/objects/test_ec2.py +++ b/nova/tests/unit/objects/test_ec2.py @@ -12,7 +12,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.db.main import api as db diff --git a/nova/tests/unit/objects/test_external_event.py b/nova/tests/unit/objects/test_external_event.py index 915358ba59..58c45c2549 100644 --- a/nova/tests/unit/objects/test_external_event.py +++ b/nova/tests/unit/objects/test_external_event.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.objects import external_event as external_event_obj from nova.tests.unit.objects import test_objects diff --git a/nova/tests/unit/objects/test_fields.py b/nova/tests/unit/objects/test_fields.py index 39f9de8cfe..2574d93c80 100644 --- a/nova/tests/unit/objects/test_fields.py +++ b/nova/tests/unit/objects/test_fields.py @@ -15,9 +15,9 @@ import collections import datetime import os +from unittest import mock import iso8601 -import mock from oslo_serialization import jsonutils from oslo_versionedobjects import exception as ovo_exc diff --git a/nova/tests/unit/objects/test_flavor.py b/nova/tests/unit/objects/test_flavor.py index 93294d95aa..4172d3fda3 100644 --- a/nova/tests/unit/objects/test_flavor.py +++ b/nova/tests/unit/objects/test_flavor.py @@ -13,8 +13,8 @@ # under the License. import datetime +from unittest import mock -import mock from oslo_db import exception as db_exc from oslo_utils import uuidutils diff --git a/nova/tests/unit/objects/test_host_mapping.py b/nova/tests/unit/objects/test_host_mapping.py index 8917e318af..73eadb7047 100644 --- a/nova/tests/unit/objects/test_host_mapping.py +++ b/nova/tests/unit/objects/test_host_mapping.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_db import exception as db_exc from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/objects/test_instance.py b/nova/tests/unit/objects/test_instance.py index 6004bdf63d..de8b8d94fa 100644 --- a/nova/tests/unit/objects/test_instance.py +++ b/nova/tests/unit/objects/test_instance.py @@ -14,8 +14,8 @@ import collections import datetime +from unittest import mock -import mock import netaddr from oslo_db import exception as db_exc from oslo_serialization import jsonutils diff --git a/nova/tests/unit/objects/test_instance_action.py b/nova/tests/unit/objects/test_instance_action.py index 1743623b1c..8322102021 100644 --- a/nova/tests/unit/objects/test_instance_action.py +++ b/nova/tests/unit/objects/test_instance_action.py @@ -14,8 +14,8 @@ import copy import traceback +from unittest import mock -import mock from oslo_utils import fixture as utils_fixture from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/objects/test_instance_device_metadata.py b/nova/tests/unit/objects/test_instance_device_metadata.py index 6f998db84e..c04d02dcb7 100644 --- a/nova/tests/unit/objects/test_instance_device_metadata.py +++ b/nova/tests/unit/objects/test_instance_device_metadata.py @@ -10,7 +10,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 import objects diff --git a/nova/tests/unit/objects/test_instance_fault.py b/nova/tests/unit/objects/test_instance_fault.py index b19d8663c1..1816801fca 100644 --- a/nova/tests/unit/objects/test_instance_fault.py +++ b/nova/tests/unit/objects/test_instance_fault.py @@ -12,7 +12,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.db.main import api as db diff --git a/nova/tests/unit/objects/test_instance_group.py b/nova/tests/unit/objects/test_instance_group.py index 90efb62902..5ea566fea7 100644 --- a/nova/tests/unit/objects/test_instance_group.py +++ b/nova/tests/unit/objects/test_instance_group.py @@ -13,8 +13,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/objects/test_instance_info_cache.py b/nova/tests/unit/objects/test_instance_info_cache.py index 13c1082ffc..2c4d6a3263 100644 --- a/nova/tests/unit/objects/test_instance_info_cache.py +++ b/nova/tests/unit/objects/test_instance_info_cache.py @@ -13,8 +13,8 @@ # under the License. import datetime +from unittest import mock -import mock from oslo_db import exception as db_exc from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/objects/test_instance_mapping.py b/nova/tests/unit/objects/test_instance_mapping.py index 2c877c0a1f..865f5b6581 100644 --- a/nova/tests/unit/objects/test_instance_mapping.py +++ b/nova/tests/unit/objects/test_instance_mapping.py @@ -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 uuidutils from sqlalchemy.orm import exc as orm_exc diff --git a/nova/tests/unit/objects/test_instance_numa.py b/nova/tests/unit/objects/test_instance_numa.py index f7a9ef7a1d..0d3bd0dba0 100644 --- a/nova/tests/unit/objects/test_instance_numa.py +++ b/nova/tests/unit/objects/test_instance_numa.py @@ -11,7 +11,8 @@ # under the License. import copy -import mock +from unittest import mock + from oslo_utils.fixture import uuidsentinel as uuids from oslo_versionedobjects import base as ovo_base import testtools diff --git a/nova/tests/unit/objects/test_instance_pci_requests.py b/nova/tests/unit/objects/test_instance_pci_requests.py index 3f21b26010..91b289dbd5 100644 --- a/nova/tests/unit/objects/test_instance_pci_requests.py +++ b/nova/tests/unit/objects/test_instance_pci_requests.py @@ -10,7 +10,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 from oslo_versionedobjects import base as ovo_base diff --git a/nova/tests/unit/objects/test_keypair.py b/nova/tests/unit/objects/test_keypair.py index ad405b7e1b..b86bbb44de 100644 --- a/nova/tests/unit/objects/test_keypair.py +++ b/nova/tests/unit/objects/test_keypair.py @@ -12,7 +12,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 nova import exception diff --git a/nova/tests/unit/objects/test_migration.py b/nova/tests/unit/objects/test_migration.py index 970122a409..6da232b933 100644 --- a/nova/tests/unit/objects/test_migration.py +++ b/nova/tests/unit/objects/test_migration.py @@ -12,7 +12,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 timeutils diff --git a/nova/tests/unit/objects/test_migration_context.py b/nova/tests/unit/objects/test_migration_context.py index 94e8e9d57f..12becaee38 100644 --- a/nova/tests/unit/objects/test_migration_context.py +++ b/nova/tests/unit/objects/test_migration_context.py @@ -10,7 +10,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 diff --git a/nova/tests/unit/objects/test_objects.py b/nova/tests/unit/objects/test_objects.py index 6f162dc3bb..1897117115 100644 --- a/nova/tests/unit/objects/test_objects.py +++ b/nova/tests/unit/objects/test_objects.py @@ -19,9 +19,9 @@ import datetime import inspect import os import pprint +from unittest import mock import fixtures -import mock from oslo_utils import timeutils from oslo_versionedobjects import base as ovo_base from oslo_versionedobjects import exception as ovo_exc diff --git a/nova/tests/unit/objects/test_pci_device.py b/nova/tests/unit/objects/test_pci_device.py index 91ec566c32..1e971c5a21 100644 --- a/nova/tests/unit/objects/test_pci_device.py +++ b/nova/tests/unit/objects/test_pci_device.py @@ -14,8 +14,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/objects/test_quotas.py b/nova/tests/unit/objects/test_quotas.py index 154c9f278a..15da48f1c4 100644 --- a/nova/tests/unit/objects/test_quotas.py +++ b/nova/tests/unit/objects/test_quotas.py @@ -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.db.main import api as db_api diff --git a/nova/tests/unit/objects/test_request_spec.py b/nova/tests/unit/objects/test_request_spec.py index 9c23fd4983..d91015a699 100644 --- a/nova/tests/unit/objects/test_request_spec.py +++ b/nova/tests/unit/objects/test_request_spec.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. import collections +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import uuidutils diff --git a/nova/tests/unit/objects/test_resource.py b/nova/tests/unit/objects/test_resource.py index 3ac12eee84..0e43df185b 100644 --- a/nova/tests/unit/objects/test_resource.py +++ b/nova/tests/unit/objects/test_resource.py @@ -10,7 +10,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 diff --git a/nova/tests/unit/objects/test_security_group.py b/nova/tests/unit/objects/test_security_group.py index 7d6a3773c5..527e5d84d6 100644 --- a/nova/tests/unit/objects/test_security_group.py +++ b/nova/tests/unit/objects/test_security_group.py @@ -12,7 +12,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 diff --git a/nova/tests/unit/objects/test_service.py b/nova/tests/unit/objects/test_service.py index 84cbd4bf6a..60ab806207 100644 --- a/nova/tests/unit/objects/test_service.py +++ b/nova/tests/unit/objects/test_service.py @@ -12,7 +12,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 timeutils from oslo_versionedobjects import base as ovo_base diff --git a/nova/tests/unit/objects/test_tag.py b/nova/tests/unit/objects/test_tag.py index 29579b1e78..caf039152d 100644 --- a/nova/tests/unit/objects/test_tag.py +++ b/nova/tests/unit/objects/test_tag.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.objects import tag from nova.tests.unit.objects import test_objects diff --git a/nova/tests/unit/objects/test_task_log.py b/nova/tests/unit/objects/test_task_log.py index 6d93ebab4c..2ac7971c28 100644 --- a/nova/tests/unit/objects/test_task_log.py +++ b/nova/tests/unit/objects/test_task_log.py @@ -11,9 +11,9 @@ # under the License. import datetime +from unittest import mock import iso8601 -import mock from oslo_utils import timeutils from nova import objects diff --git a/nova/tests/unit/objects/test_trusted_certs.py b/nova/tests/unit/objects/test_trusted_certs.py index 3010dd6b5c..9029845ef3 100644 --- a/nova/tests/unit/objects/test_trusted_certs.py +++ b/nova/tests/unit/objects/test_trusted_certs.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.objects import trusted_certs from nova.tests.unit.objects import test_objects diff --git a/nova/tests/unit/objects/test_virtual_interface.py b/nova/tests/unit/objects/test_virtual_interface.py index a9049bac88..a806668c6b 100644 --- a/nova/tests/unit/objects/test_virtual_interface.py +++ b/nova/tests/unit/objects/test_virtual_interface.py @@ -12,7 +12,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.db.main import api as db diff --git a/nova/tests/unit/objects/test_volume_usage.py b/nova/tests/unit/objects/test_volume_usage.py index a465955ad6..d8df53d5c7 100644 --- a/nova/tests/unit/objects/test_volume_usage.py +++ b/nova/tests/unit/objects/test_volume_usage.py @@ -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 timeutils diff --git a/nova/tests/unit/pci/fakes.py b/nova/tests/unit/pci/fakes.py index 93ab33b27f..e0267ff087 100644 --- a/nova/tests/unit/pci/fakes.py +++ b/nova/tests/unit/pci/fakes.py @@ -14,8 +14,8 @@ # under the License. import functools +from unittest import mock -import mock from nova.pci import whitelist diff --git a/nova/tests/unit/pci/test_devspec.py b/nova/tests/unit/pci/test_devspec.py index 1b7af10316..f51ee54ac1 100644 --- a/nova/tests/unit/pci/test_devspec.py +++ b/nova/tests/unit/pci/test_devspec.py @@ -11,8 +11,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 import objects diff --git a/nova/tests/unit/pci/test_manager.py b/nova/tests/unit/pci/test_manager.py index 6682b3e3b2..6ce248beba 100644 --- a/nova/tests/unit/pci/test_manager.py +++ b/nova/tests/unit/pci/test_manager.py @@ -14,8 +14,8 @@ # under the License. import copy +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel diff --git a/nova/tests/unit/pci/test_request.py b/nova/tests/unit/pci/test_request.py index 432f03b0b2..7aefbd15fd 100644 --- a/nova/tests/unit/pci/test_request.py +++ b/nova/tests/unit/pci/test_request.py @@ -15,7 +15,8 @@ """Tests for PCI request.""" -import mock +from unittest import mock + from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel diff --git a/nova/tests/unit/pci/test_stats.py b/nova/tests/unit/pci/test_stats.py index b60986a87d..860880982a 100644 --- a/nova/tests/unit/pci/test_stats.py +++ b/nova/tests/unit/pci/test_stats.py @@ -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 import exception diff --git a/nova/tests/unit/pci/test_utils.py b/nova/tests/unit/pci/test_utils.py index 1a8b273433..1a1f9955b9 100644 --- a/nova/tests/unit/pci/test_utils.py +++ b/nova/tests/unit/pci/test_utils.py @@ -16,9 +16,9 @@ import glob import os +from unittest import mock import fixtures -import mock from nova import exception from nova.pci import utils diff --git a/nova/tests/unit/policies/test_admin_actions.py b/nova/tests/unit/policies/test_admin_actions.py index 42cb74302f..60458a1a80 100644 --- a/nova/tests/unit/policies/test_admin_actions.py +++ b/nova/tests/unit/policies/test_admin_actions.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_admin_password.py b/nova/tests/unit/policies/test_admin_password.py index cec2f27f53..e5975086f4 100644 --- a/nova/tests/unit/policies/test_admin_password.py +++ b/nova/tests/unit/policies/test_admin_password.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_aggregates.py b/nova/tests/unit/policies/test_aggregates.py index dbb8a69552..8aaf0a6101 100644 --- a/nova/tests/unit/policies/test_aggregates.py +++ b/nova/tests/unit/policies/test_aggregates.py @@ -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.api.openstack.compute import aggregates diff --git a/nova/tests/unit/policies/test_assisted_volume_snapshots.py b/nova/tests/unit/policies/test_assisted_volume_snapshots.py index 5f7d6978e5..dce62e5bcc 100644 --- a/nova/tests/unit/policies/test_assisted_volume_snapshots.py +++ b/nova/tests/unit/policies/test_assisted_volume_snapshots.py @@ -10,7 +10,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 import urllib diff --git a/nova/tests/unit/policies/test_attach_interfaces.py b/nova/tests/unit/policies/test_attach_interfaces.py index 8625369d61..781ce29e8a 100644 --- a/nova/tests/unit/policies/test_attach_interfaces.py +++ b/nova/tests/unit/policies/test_attach_interfaces.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_availability_zone.py b/nova/tests/unit/policies/test_availability_zone.py index 6814d030cc..d021cc14d8 100644 --- a/nova/tests/unit/policies/test_availability_zone.py +++ b/nova/tests/unit/policies/test_availability_zone.py @@ -10,7 +10,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 availability_zone from nova.tests.unit.api.openstack import fakes diff --git a/nova/tests/unit/policies/test_baremetal_nodes.py b/nova/tests/unit/policies/test_baremetal_nodes.py index 639c314f23..7a045b2ff0 100644 --- a/nova/tests/unit/policies/test_baremetal_nodes.py +++ b/nova/tests/unit/policies/test_baremetal_nodes.py @@ -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.api.openstack.compute import baremetal_nodes diff --git a/nova/tests/unit/policies/test_console_auth_tokens.py b/nova/tests/unit/policies/test_console_auth_tokens.py index ba70355d17..a658816538 100644 --- a/nova/tests/unit/policies/test_console_auth_tokens.py +++ b/nova/tests/unit/policies/test_console_auth_tokens.py @@ -10,7 +10,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 console_auth_tokens from nova.tests.unit.api.openstack import fakes diff --git a/nova/tests/unit/policies/test_console_output.py b/nova/tests/unit/policies/test_console_output.py index 4067987541..0c3ed9ed2d 100644 --- a/nova/tests/unit/policies/test_console_output.py +++ b/nova/tests/unit/policies/test_console_output.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_create_backup.py b/nova/tests/unit/policies/test_create_backup.py index a0eb696b89..83762e2214 100644 --- a/nova/tests/unit/policies/test_create_backup.py +++ b/nova/tests/unit/policies/test_create_backup.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_deferred_delete.py b/nova/tests/unit/policies/test_deferred_delete.py index 1eb4f365c7..faa26e7b15 100644 --- a/nova/tests/unit/policies/test_deferred_delete.py +++ b/nova/tests/unit/policies/test_deferred_delete.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_evacuate.py b/nova/tests/unit/policies/test_evacuate.py index c9993814ff..491b17779c 100644 --- a/nova/tests/unit/policies/test_evacuate.py +++ b/nova/tests/unit/policies/test_evacuate.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_flavor_access.py b/nova/tests/unit/policies/test_flavor_access.py index 68c31c75f9..7a3ebf96cb 100644 --- a/nova/tests/unit/policies/test_flavor_access.py +++ b/nova/tests/unit/policies/test_flavor_access.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import flavor_access diff --git a/nova/tests/unit/policies/test_flavor_extra_specs.py b/nova/tests/unit/policies/test_flavor_extra_specs.py index 7da297b6e1..fdb93e6a7c 100644 --- a/nova/tests/unit/policies/test_flavor_extra_specs.py +++ b/nova/tests/unit/policies/test_flavor_extra_specs.py @@ -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.api.openstack.compute import flavor_manage diff --git a/nova/tests/unit/policies/test_flavor_manage.py b/nova/tests/unit/policies/test_flavor_manage.py index 32e25b5474..0422469a11 100644 --- a/nova/tests/unit/policies/test_flavor_manage.py +++ b/nova/tests/unit/policies/test_flavor_manage.py @@ -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.api.openstack.compute import flavor_manage diff --git a/nova/tests/unit/policies/test_floating_ip_pools.py b/nova/tests/unit/policies/test_floating_ip_pools.py index 08f36134d5..22fca84bbd 100644 --- a/nova/tests/unit/policies/test_floating_ip_pools.py +++ b/nova/tests/unit/policies/test_floating_ip_pools.py @@ -10,7 +10,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 from nova.tests.unit.api.openstack import fakes diff --git a/nova/tests/unit/policies/test_floating_ips.py b/nova/tests/unit/policies/test_floating_ips.py index b170d9049b..12beca9d56 100644 --- a/nova/tests/unit/policies/test_floating_ips.py +++ b/nova/tests/unit/policies/test_floating_ips.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_hosts.py b/nova/tests/unit/policies/test_hosts.py index 19727f7060..a5147dab82 100644 --- a/nova/tests/unit/policies/test_hosts.py +++ b/nova/tests/unit/policies/test_hosts.py @@ -10,7 +10,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 hosts from nova.policies import base as base_policy diff --git a/nova/tests/unit/policies/test_hypervisors.py b/nova/tests/unit/policies/test_hypervisors.py index 281e32d026..fbdf805fce 100644 --- a/nova/tests/unit/policies/test_hypervisors.py +++ b/nova/tests/unit/policies/test_hypervisors.py @@ -10,7 +10,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 hypervisors from nova.policies import base as base_policy diff --git a/nova/tests/unit/policies/test_instance_actions.py b/nova/tests/unit/policies/test_instance_actions.py index 4a3e409244..2225261d5e 100644 --- a/nova/tests/unit/policies/test_instance_actions.py +++ b/nova/tests/unit/policies/test_instance_actions.py @@ -11,8 +11,9 @@ # under the License. import copy +from unittest import mock + import fixtures -import mock from nova.api.openstack import api_version_request from oslo_policy import policy as oslo_policy diff --git a/nova/tests/unit/policies/test_instance_usage_audit_log.py b/nova/tests/unit/policies/test_instance_usage_audit_log.py index 4a73d4328a..311a404075 100644 --- a/nova/tests/unit/policies/test_instance_usage_audit_log.py +++ b/nova/tests/unit/policies/test_instance_usage_audit_log.py @@ -10,7 +10,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 instance_usage_audit_log as iual from nova.policies import base as base_policy diff --git a/nova/tests/unit/policies/test_keypairs.py b/nova/tests/unit/policies/test_keypairs.py index d74e929ef2..b30d5e2455 100644 --- a/nova/tests/unit/policies/test_keypairs.py +++ b/nova/tests/unit/policies/test_keypairs.py @@ -10,7 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from nova.policies import keypairs as policies from nova.api.openstack.compute import keypairs diff --git a/nova/tests/unit/policies/test_limits.py b/nova/tests/unit/policies/test_limits.py index e0e14fcfb2..1141f148bb 100644 --- a/nova/tests/unit/policies/test_limits.py +++ b/nova/tests/unit/policies/test_limits.py @@ -11,8 +11,7 @@ # under the License. import functools - -import mock +from unittest import mock from nova.api.openstack.compute import limits import nova.conf diff --git a/nova/tests/unit/policies/test_lock_server.py b/nova/tests/unit/policies/test_lock_server.py index 84f78e43bc..292821c7d2 100644 --- a/nova/tests/unit/policies/test_lock_server.py +++ b/nova/tests/unit/policies/test_lock_server.py @@ -11,9 +11,9 @@ # under the License. import functools +from unittest import mock import fixtures -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_migrate_server.py b/nova/tests/unit/policies/test_migrate_server.py index 8904eb01fb..43314956e6 100644 --- a/nova/tests/unit/policies/test_migrate_server.py +++ b/nova/tests/unit/policies/test_migrate_server.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_migrations.py b/nova/tests/unit/policies/test_migrations.py index 61b5240a95..25cd75a125 100644 --- a/nova/tests/unit/policies/test_migrations.py +++ b/nova/tests/unit/policies/test_migrations.py @@ -10,7 +10,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 migrations from nova.policies import migrations as migrations_policies diff --git a/nova/tests/unit/policies/test_multinic.py b/nova/tests/unit/policies/test_multinic.py index be04e8ba83..cd35994f1b 100644 --- a/nova/tests/unit/policies/test_multinic.py +++ b/nova/tests/unit/policies/test_multinic.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_networks.py b/nova/tests/unit/policies/test_networks.py index c5578c4d34..25011859e3 100644 --- a/nova/tests/unit/policies/test_networks.py +++ b/nova/tests/unit/policies/test_networks.py @@ -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.api.openstack.compute import networks diff --git a/nova/tests/unit/policies/test_pause_server.py b/nova/tests/unit/policies/test_pause_server.py index 69602eac4e..aa27a7c701 100644 --- a/nova/tests/unit/policies/test_pause_server.py +++ b/nova/tests/unit/policies/test_pause_server.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_quota_class_sets.py b/nova/tests/unit/policies/test_quota_class_sets.py index 98969f2fa1..d008092a95 100644 --- a/nova/tests/unit/policies/test_quota_class_sets.py +++ b/nova/tests/unit/policies/test_quota_class_sets.py @@ -10,7 +10,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 quota_classes from nova.policies import quota_class_sets as policies diff --git a/nova/tests/unit/policies/test_quota_sets.py b/nova/tests/unit/policies/test_quota_sets.py index c0e29236b6..64932b7fa4 100644 --- a/nova/tests/unit/policies/test_quota_sets.py +++ b/nova/tests/unit/policies/test_quota_sets.py @@ -10,7 +10,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 quota_sets from nova import exception diff --git a/nova/tests/unit/policies/test_remote_consoles.py b/nova/tests/unit/policies/test_remote_consoles.py index 648e5594bc..a01efd8e42 100644 --- a/nova/tests/unit/policies/test_remote_consoles.py +++ b/nova/tests/unit/policies/test_remote_consoles.py @@ -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.policies import remote_consoles as rc_policies from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_rescue.py b/nova/tests/unit/policies/test_rescue.py index 3e159bebaa..a8e41c8631 100644 --- a/nova/tests/unit/policies/test_rescue.py +++ b/nova/tests/unit/policies/test_rescue.py @@ -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.policies import base as base_policy from nova.policies import rescue as rs_policies from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/policies/test_security_groups.py b/nova/tests/unit/policies/test_security_groups.py index 689c71d93b..b7afac26cb 100644 --- a/nova/tests/unit/policies/test_security_groups.py +++ b/nova/tests/unit/policies/test_security_groups.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_server_diagnostics.py b/nova/tests/unit/policies/test_server_diagnostics.py index 76c0b4594c..932f5e2033 100644 --- a/nova/tests/unit/policies/test_server_diagnostics.py +++ b/nova/tests/unit/policies/test_server_diagnostics.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_server_external_events.py b/nova/tests/unit/policies/test_server_external_events.py index 630b3e8531..401b55325f 100644 --- a/nova/tests/unit/policies/test_server_external_events.py +++ b/nova/tests/unit/policies/test_server_external_events.py @@ -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.api.openstack.compute import server_external_events as ev diff --git a/nova/tests/unit/policies/test_server_groups.py b/nova/tests/unit/policies/test_server_groups.py index d8894cb8ed..f93855b175 100644 --- a/nova/tests/unit/policies/test_server_groups.py +++ b/nova/tests/unit/policies/test_server_groups.py @@ -11,8 +11,9 @@ # under the License. import functools +from unittest import mock + import fixtures -import mock from oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import server_groups diff --git a/nova/tests/unit/policies/test_server_metadata.py b/nova/tests/unit/policies/test_server_metadata.py index a915245ea8..8b95d05894 100644 --- a/nova/tests/unit/policies/test_server_metadata.py +++ b/nova/tests/unit/policies/test_server_metadata.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import server_metadata diff --git a/nova/tests/unit/policies/test_server_migrations.py b/nova/tests/unit/policies/test_server_migrations.py index d6c249d166..bf69166b53 100644 --- a/nova/tests/unit/policies/test_server_migrations.py +++ b/nova/tests/unit/policies/test_server_migrations.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -import fixtures -import mock +from unittest import mock +import fixtures from oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import server_migrations diff --git a/nova/tests/unit/policies/test_server_password.py b/nova/tests/unit/policies/test_server_password.py index 613b60a30b..48f2046693 100644 --- a/nova/tests/unit/policies/test_server_password.py +++ b/nova/tests/unit/policies/test_server_password.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import server_password diff --git a/nova/tests/unit/policies/test_server_tags.py b/nova/tests/unit/policies/test_server_tags.py index 427401ddfc..1d905e2b3d 100644 --- a/nova/tests/unit/policies/test_server_tags.py +++ b/nova/tests/unit/policies/test_server_tags.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import server_tags diff --git a/nova/tests/unit/policies/test_servers.py b/nova/tests/unit/policies/test_servers.py index 3ed4bfe085..e089e5245d 100644 --- a/nova/tests/unit/policies/test_servers.py +++ b/nova/tests/unit/policies/test_servers.py @@ -11,9 +11,9 @@ # under the License. import functools +from unittest import mock import fixtures -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/policies/test_services.py b/nova/tests/unit/policies/test_services.py index aae037d678..5a77b559ba 100644 --- a/nova/tests/unit/policies/test_services.py +++ b/nova/tests/unit/policies/test_services.py @@ -11,7 +11,7 @@ # under the License. -import mock +from unittest import mock from nova.api.openstack.compute import services as services_v21 from nova.tests.unit.api.openstack import fakes diff --git a/nova/tests/unit/policies/test_shelve.py b/nova/tests/unit/policies/test_shelve.py index 2424d78461..87bff30178 100644 --- a/nova/tests/unit/policies/test_shelve.py +++ b/nova/tests/unit/policies/test_shelve.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import shelve diff --git a/nova/tests/unit/policies/test_simple_tenant_usage.py b/nova/tests/unit/policies/test_simple_tenant_usage.py index 7ae028bd5e..1dbd0715d1 100644 --- a/nova/tests/unit/policies/test_simple_tenant_usage.py +++ b/nova/tests/unit/policies/test_simple_tenant_usage.py @@ -10,7 +10,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 simple_tenant_usage from nova.policies import simple_tenant_usage as policies diff --git a/nova/tests/unit/policies/test_suspend_server.py b/nova/tests/unit/policies/test_suspend_server.py index 9ef95c61d9..729f13b4b3 100644 --- a/nova/tests/unit/policies/test_suspend_server.py +++ b/nova/tests/unit/policies/test_suspend_server.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from nova.api.openstack.compute import suspend_server diff --git a/nova/tests/unit/policies/test_tenant_networks.py b/nova/tests/unit/policies/test_tenant_networks.py index 9359567b65..dedcc3cfa9 100644 --- a/nova/tests/unit/policies/test_tenant_networks.py +++ b/nova/tests/unit/policies/test_tenant_networks.py @@ -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.api.openstack.compute import tenant_networks diff --git a/nova/tests/unit/policies/test_volumes.py b/nova/tests/unit/policies/test_volumes.py index 2caefed3be..53985e7ab1 100644 --- a/nova/tests/unit/policies/test_volumes.py +++ b/nova/tests/unit/policies/test_volumes.py @@ -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 oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/privsep/test_fs.py b/nova/tests/unit/privsep/test_fs.py index 89062acce9..919b6c553d 100644 --- a/nova/tests/unit/privsep/test_fs.py +++ b/nova/tests/unit/privsep/test_fs.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import nova.privsep.fs from nova import test diff --git a/nova/tests/unit/privsep/test_idmapshift.py b/nova/tests/unit/privsep/test_idmapshift.py index 2b5acbe33c..7c6f7833ff 100644 --- a/nova/tests/unit/privsep/test_idmapshift.py +++ b/nova/tests/unit/privsep/test_idmapshift.py @@ -13,9 +13,9 @@ # limitations under the License. from io import StringIO +from unittest import mock import fixtures -import mock import nova.privsep.idmapshift from nova import test diff --git a/nova/tests/unit/privsep/test_libvirt.py b/nova/tests/unit/privsep/test_libvirt.py index 32d375bb1c..eebcf6c231 100644 --- a/nova/tests/unit/privsep/test_libvirt.py +++ b/nova/tests/unit/privsep/test_libvirt.py @@ -15,8 +15,9 @@ # under the License. import binascii +from unittest import mock + import ddt -import mock import os import nova.privsep.libvirt diff --git a/nova/tests/unit/privsep/test_linux_net.py b/nova/tests/unit/privsep/test_linux_net.py index 5bdac6ca02..6b226359c3 100644 --- a/nova/tests/unit/privsep/test_linux_net.py +++ b/nova/tests/unit/privsep/test_linux_net.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from oslo_concurrency import processutils diff --git a/nova/tests/unit/privsep/test_path.py b/nova/tests/unit/privsep/test_path.py index 1b4955837d..853ee01d09 100644 --- a/nova/tests/unit/privsep/test_path.py +++ b/nova/tests/unit/privsep/test_path.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock import os +from unittest import mock + import tempfile from nova import exception diff --git a/nova/tests/unit/privsep/test_qemu.py b/nova/tests/unit/privsep/test_qemu.py index 85c48aa4ae..f3fe5599f2 100644 --- a/nova/tests/unit/privsep/test_qemu.py +++ b/nova/tests/unit/privsep/test_qemu.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import nova.privsep.qemu from nova import test diff --git a/nova/tests/unit/privsep/test_utils.py b/nova/tests/unit/privsep/test_utils.py index 84d0767c29..887e6dfa8b 100644 --- a/nova/tests/unit/privsep/test_utils.py +++ b/nova/tests/unit/privsep/test_utils.py @@ -13,8 +13,8 @@ # under the License. import errno -import mock import os +from unittest import mock import nova.privsep.utils from nova import test diff --git a/nova/tests/unit/scheduler/client/test_query.py b/nova/tests/unit/scheduler/client/test_query.py index f8ea4aa337..fe23cf88e3 100644 --- a/nova/tests/unit/scheduler/client/test_query.py +++ b/nova/tests/unit/scheduler/client/test_query.py @@ -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 import context diff --git a/nova/tests/unit/scheduler/client/test_report.py b/nova/tests/unit/scheduler/client/test_report.py index 0650c62096..288a7530aa 100644 --- a/nova/tests/unit/scheduler/client/test_report.py +++ b/nova/tests/unit/scheduler/client/test_report.py @@ -9,13 +9,14 @@ # 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 time +from unittest import mock from urllib import parse 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 diff --git a/nova/tests/unit/scheduler/filters/test_affinity_filters.py b/nova/tests/unit/scheduler/filters/test_affinity_filters.py index 45c4d9834c..778fbd9073 100644 --- a/nova/tests/unit/scheduler/filters/test_affinity_filters.py +++ b/nova/tests/unit/scheduler/filters/test_affinity_filters.py @@ -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 import objects diff --git a/nova/tests/unit/scheduler/filters/test_aggregate_image_properties_isolation_filters.py b/nova/tests/unit/scheduler/filters/test_aggregate_image_properties_isolation_filters.py index f17a7168f1..09b8d728b2 100644 --- a/nova/tests/unit/scheduler/filters/test_aggregate_image_properties_isolation_filters.py +++ b/nova/tests/unit/scheduler/filters/test_aggregate_image_properties_isolation_filters.py @@ -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 objects from nova.scheduler.filters import aggregate_image_properties_isolation as aipi diff --git a/nova/tests/unit/scheduler/filters/test_aggregate_instance_extra_specs_filters.py b/nova/tests/unit/scheduler/filters/test_aggregate_instance_extra_specs_filters.py index 3567d85a62..971e1a366c 100644 --- a/nova/tests/unit/scheduler/filters/test_aggregate_instance_extra_specs_filters.py +++ b/nova/tests/unit/scheduler/filters/test_aggregate_instance_extra_specs_filters.py @@ -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 objects from nova.scheduler.filters import aggregate_instance_extra_specs as agg_specs diff --git a/nova/tests/unit/scheduler/filters/test_aggregate_multitenancy_isolation_filters.py b/nova/tests/unit/scheduler/filters/test_aggregate_multitenancy_isolation_filters.py index 6e6ae9a421..7f2f75a5bd 100644 --- a/nova/tests/unit/scheduler/filters/test_aggregate_multitenancy_isolation_filters.py +++ b/nova/tests/unit/scheduler/filters/test_aggregate_multitenancy_isolation_filters.py @@ -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 objects from nova.scheduler.filters import aggregate_multitenancy_isolation as ami diff --git a/nova/tests/unit/scheduler/filters/test_availability_zone_filters.py b/nova/tests/unit/scheduler/filters/test_availability_zone_filters.py index 2c1a43225e..38a75452ba 100644 --- a/nova/tests/unit/scheduler/filters/test_availability_zone_filters.py +++ b/nova/tests/unit/scheduler/filters/test_availability_zone_filters.py @@ -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 objects from nova.scheduler.filters import availability_zone_filter diff --git a/nova/tests/unit/scheduler/filters/test_compute_filters.py b/nova/tests/unit/scheduler/filters/test_compute_filters.py index d9cee4c410..335b9d07be 100644 --- a/nova/tests/unit/scheduler/filters/test_compute_filters.py +++ b/nova/tests/unit/scheduler/filters/test_compute_filters.py @@ -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 objects from nova.scheduler.filters import compute_filter diff --git a/nova/tests/unit/scheduler/filters/test_io_ops_filters.py b/nova/tests/unit/scheduler/filters/test_io_ops_filters.py index fd0dc3aca1..3b06aaf069 100644 --- a/nova/tests/unit/scheduler/filters/test_io_ops_filters.py +++ b/nova/tests/unit/scheduler/filters/test_io_ops_filters.py @@ -11,7 +11,7 @@ # under the License. -import mock +from unittest import mock from nova import objects from nova.scheduler.filters import io_ops_filter diff --git a/nova/tests/unit/scheduler/filters/test_num_instances_filters.py b/nova/tests/unit/scheduler/filters/test_num_instances_filters.py index 070cc3a785..b43a9b1dc1 100644 --- a/nova/tests/unit/scheduler/filters/test_num_instances_filters.py +++ b/nova/tests/unit/scheduler/filters/test_num_instances_filters.py @@ -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 objects from nova.scheduler.filters import num_instances_filter diff --git a/nova/tests/unit/scheduler/filters/test_pci_passthrough_filters.py b/nova/tests/unit/scheduler/filters/test_pci_passthrough_filters.py index c500b4a887..edd9735b34 100644 --- a/nova/tests/unit/scheduler/filters/test_pci_passthrough_filters.py +++ b/nova/tests/unit/scheduler/filters/test_pci_passthrough_filters.py @@ -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 objects from nova.pci import stats diff --git a/nova/tests/unit/scheduler/filters/test_type_filters.py b/nova/tests/unit/scheduler/filters/test_type_filters.py index d3f01a5c0e..c2567b5205 100644 --- a/nova/tests/unit/scheduler/filters/test_type_filters.py +++ b/nova/tests/unit/scheduler/filters/test_type_filters.py @@ -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 objects from nova.scheduler.filters import type_filter diff --git a/nova/tests/unit/scheduler/test_filters.py b/nova/tests/unit/scheduler/test_filters.py index cb1c3ec32b..64f4121eb0 100644 --- a/nova/tests/unit/scheduler/test_filters.py +++ b/nova/tests/unit/scheduler/test_filters.py @@ -16,8 +16,8 @@ Tests For Scheduler Host Filters. """ import inspect +from unittest import mock -import mock from oslo_utils.fixture import uuidsentinel as uuids from nova import filters diff --git a/nova/tests/unit/scheduler/test_host_manager.py b/nova/tests/unit/scheduler/test_host_manager.py index 5a1e665be3..c4445d5578 100644 --- a/nova/tests/unit/scheduler/test_host_manager.py +++ b/nova/tests/unit/scheduler/test_host_manager.py @@ -19,8 +19,8 @@ Tests For HostManager import collections import contextlib import datetime +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import versionutils diff --git a/nova/tests/unit/scheduler/test_manager.py b/nova/tests/unit/scheduler/test_manager.py index 70689f6047..9356292918 100644 --- a/nova/tests/unit/scheduler/test_manager.py +++ b/nova/tests/unit/scheduler/test_manager.py @@ -17,7 +17,8 @@ Tests For Scheduler """ -import mock +from unittest import mock + import oslo_messaging as messaging from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/scheduler/test_request_filter.py b/nova/tests/unit/scheduler/test_request_filter.py index 57f2f93bf6..186482d4a8 100644 --- a/nova/tests/unit/scheduler/test_request_filter.py +++ b/nova/tests/unit/scheduler/test_request_filter.py @@ -10,8 +10,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock import os_traits as ot +from unittest import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils diff --git a/nova/tests/unit/scheduler/test_rpcapi.py b/nova/tests/unit/scheduler/test_rpcapi.py index 3c56946975..51582891aa 100644 --- a/nova/tests/unit/scheduler/test_rpcapi.py +++ b/nova/tests/unit/scheduler/test_rpcapi.py @@ -16,7 +16,8 @@ Unit Tests for nova.scheduler.rpcapi """ -import mock +from unittest import mock + from oslo_utils.fixture import uuidsentinel as uuids from nova import conf diff --git a/nova/tests/unit/scheduler/test_utils.py b/nova/tests/unit/scheduler/test_utils.py index 8aff5b902e..55957f3d55 100644 --- a/nova/tests/unit/scheduler/test_utils.py +++ b/nova/tests/unit/scheduler/test_utils.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock import os_resource_classes as orc from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/scheduler/weights/test_weights_affinity.py b/nova/tests/unit/scheduler/weights/test_weights_affinity.py index 10ec7e698d..3048e9f06c 100644 --- a/nova/tests/unit/scheduler/weights/test_weights_affinity.py +++ b/nova/tests/unit/scheduler/weights/test_weights_affinity.py @@ -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.scheduler import weights diff --git a/nova/tests/unit/servicegroup/test_api.py b/nova/tests/unit/servicegroup/test_api.py index b451285e4e..4ded10360a 100644 --- a/nova/tests/unit/servicegroup/test_api.py +++ b/nova/tests/unit/servicegroup/test_api.py @@ -15,7 +15,7 @@ """ Test the base class for the servicegroup API """ -import mock +from unittest import mock from nova import servicegroup from nova import test diff --git a/nova/tests/unit/servicegroup/test_db_servicegroup.py b/nova/tests/unit/servicegroup/test_db_servicegroup.py index 9e04451ec7..9f718e17b7 100644 --- a/nova/tests/unit/servicegroup/test_db_servicegroup.py +++ b/nova/tests/unit/servicegroup/test_db_servicegroup.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + import oslo_messaging as messaging from oslo_utils import fixture as utils_fixture from oslo_utils import timeutils diff --git a/nova/tests/unit/servicegroup/test_mc_servicegroup.py b/nova/tests/unit/servicegroup/test_mc_servicegroup.py index 3b8399dfe3..e3896bb375 100644 --- a/nova/tests/unit/servicegroup/test_mc_servicegroup.py +++ b/nova/tests/unit/servicegroup/test_mc_servicegroup.py @@ -16,7 +16,7 @@ # under the License. import iso8601 -import mock +from unittest import mock from nova import servicegroup from nova import test diff --git a/nova/tests/unit/storage/test_rbd.py b/nova/tests/unit/storage/test_rbd.py index 396f22c643..f89c2dee89 100644 --- a/nova/tests/unit/storage/test_rbd.py +++ b/nova/tests/unit/storage/test_rbd.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock from eventlet import tpool -import mock from oslo_concurrency import processutils from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids @@ -524,7 +524,7 @@ class RbdTestCase(test.NoDBTestCase): self.driver.destroy_volume(vol) # Make sure both params have the expected values - retryctx = mock_loopingcall.call_args.args[3] + retryctx = mock_loopingcall.call_args[0][3] self.assertEqual(retryctx, {'retries': 6}) loopingcall.start.assert_called_with(interval=10) diff --git a/nova/tests/unit/test_availability_zones.py b/nova/tests/unit/test_availability_zones.py index 438e8dba24..f2e02e39c7 100644 --- a/nova/tests/unit/test_availability_zones.py +++ b/nova/tests/unit/test_availability_zones.py @@ -17,7 +17,8 @@ Tests for availability zones """ -import mock +from unittest import mock + from oslo_utils.fixture import uuidsentinel from nova import availability_zones as az diff --git a/nova/tests/unit/test_block_device.py b/nova/tests/unit/test_block_device.py index f5a4fc5694..40020a203f 100644 --- a/nova/tests/unit/test_block_device.py +++ b/nova/tests/unit/test_block_device.py @@ -17,7 +17,8 @@ Tests for Block Device utility functions. """ -import mock +from unittest import mock + from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import units diff --git a/nova/tests/unit/test_cache.py b/nova/tests/unit/test_cache.py index b7059796f1..3f656a49b0 100644 --- a/nova/tests/unit/test_cache.py +++ b/nova/tests/unit/test_cache.py @@ -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 cache_utils from nova import test diff --git a/nova/tests/unit/test_cinder.py b/nova/tests/unit/test_cinder.py index 00e79711ec..e758343549 100644 --- a/nova/tests/unit/test_cinder.py +++ b/nova/tests/unit/test_cinder.py @@ -13,9 +13,9 @@ # under the License. import collections +from unittest import mock from cinderclient.v3 import client as cinder_client_v3 -import mock from requests_mock.contrib import fixture import nova.conf diff --git a/nova/tests/unit/test_conf.py b/nova/tests/unit/test_conf.py index 95a7c45114..4496922e26 100644 --- a/nova/tests/unit/test_conf.py +++ b/nova/tests/unit/test_conf.py @@ -14,8 +14,8 @@ import os import tempfile +from unittest import mock -import mock from oslo_config import cfg import nova.conf.compute diff --git a/nova/tests/unit/test_configdrive2.py b/nova/tests/unit/test_configdrive2.py index 4c0ae0acb4..d04310639b 100644 --- a/nova/tests/unit/test_configdrive2.py +++ b/nova/tests/unit/test_configdrive2.py @@ -16,8 +16,8 @@ import os import tempfile +from unittest import mock -import mock from oslo_config import cfg from oslo_utils import fileutils diff --git a/nova/tests/unit/test_context.py b/nova/tests/unit/test_context.py index 940738c50d..53c8825046 100644 --- a/nova/tests/unit/test_context.py +++ b/nova/tests/unit/test_context.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_context import context as o_context from oslo_context import fixture as o_fixture from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/test_crypto.py b/nova/tests/unit/test_crypto.py index 30152b2b01..5cf92af448 100644 --- a/nova/tests/unit/test_crypto.py +++ b/nova/tests/unit/test_crypto.py @@ -18,11 +18,11 @@ Tests for Crypto module. import io import os +from unittest import mock from castellan.common import exception as castellan_exception from cryptography.hazmat import backends from cryptography.hazmat.primitives import serialization -import mock from oslo_concurrency import processutils from oslo_utils.fixture import uuidsentinel as uuids import paramiko diff --git a/nova/tests/unit/test_exception_wrapper.py b/nova/tests/unit/test_exception_wrapper.py index 56eadf6952..71da124fd9 100644 --- a/nova/tests/unit/test_exception_wrapper.py +++ b/nova/tests/unit/test_exception_wrapper.py @@ -14,7 +14,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_wrapper diff --git a/nova/tests/unit/test_fixtures.py b/nova/tests/unit/test_fixtures.py index 5dbcd6d57a..8a5db79855 100644 --- a/nova/tests/unit/test_fixtures.py +++ b/nova/tests/unit/test_fixtures.py @@ -17,10 +17,10 @@ import copy import datetime import io +from unittest import mock import fixtures as fx import futurist -import mock from oslo_config import cfg from oslo_db import exception as db_exc from oslo_log import log as logging diff --git a/nova/tests/unit/test_hacking.py b/nova/tests/unit/test_hacking.py index e5a6efb0ad..0cf83abacb 100644 --- a/nova/tests/unit/test_hacking.py +++ b/nova/tests/unit/test_hacking.py @@ -13,8 +13,8 @@ # under the License. import textwrap +from unittest import mock -import mock import pycodestyle from nova.hacking import checks diff --git a/nova/tests/unit/test_identity.py b/nova/tests/unit/test_identity.py index 83252d8c38..2bb5e7f9c0 100644 --- a/nova/tests/unit/test_identity.py +++ b/nova/tests/unit/test_identity.py @@ -13,7 +13,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from keystoneauth1.adapter import Adapter from keystoneauth1 import exceptions as kse diff --git a/nova/tests/unit/test_json_ref.py b/nova/tests/unit/test_json_ref.py index 5a139055f5..e7cbbc9133 100644 --- a/nova/tests/unit/test_json_ref.py +++ b/nova/tests/unit/test_json_ref.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. import copy -import mock +from unittest import mock from nova import test from nova.tests import json_ref diff --git a/nova/tests/unit/test_metadata.py b/nova/tests/unit/test_metadata.py index 9d70ff252d..86e75dfac6 100644 --- a/nova/tests/unit/test_metadata.py +++ b/nova/tests/unit/test_metadata.py @@ -22,10 +22,10 @@ import hmac import os import pickle import re +from unittest import mock from keystoneauth1 import exceptions as ks_exceptions from keystoneauth1 import session -import mock from oslo_config import cfg from oslo_serialization import base64 from oslo_serialization import jsonutils diff --git a/nova/tests/unit/test_notifications.py b/nova/tests/unit/test_notifications.py index 05b446fc20..062eeb7f4f 100644 --- a/nova/tests/unit/test_notifications.py +++ b/nova/tests/unit/test_notifications.py @@ -17,8 +17,8 @@ import copy import datetime +from unittest import mock -import mock from oslo_config import cfg from oslo_context import fixture as o_fixture from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/test_notifier.py b/nova/tests/unit/test_notifier.py index 95366cdf28..fc01b1cf83 100644 --- a/nova/tests/unit/test_notifier.py +++ b/nova/tests/unit/test_notifier.py @@ -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 rpc from nova import test diff --git a/nova/tests/unit/test_policy.py b/nova/tests/unit/test_policy.py index 3aabe5a717..e4ae09f91c 100644 --- a/nova/tests/unit/test_policy.py +++ b/nova/tests/unit/test_policy.py @@ -16,8 +16,8 @@ """Test of Policy Engine For Nova.""" import os.path +from unittest import mock -import mock from oslo_policy import policy as oslo_policy from oslo_serialization import jsonutils import requests_mock diff --git a/nova/tests/unit/test_quota.py b/nova/tests/unit/test_quota.py index edbb814ba7..7979d83e91 100644 --- a/nova/tests/unit/test_quota.py +++ b/nova/tests/unit/test_quota.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from oslo_db.sqlalchemy import enginefacade from oslo_limit import fixture as limit_fixture from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/test_rpc.py b/nova/tests/unit/test_rpc.py index eece75af96..3fe56013bd 100644 --- a/nova/tests/unit/test_rpc.py +++ b/nova/tests/unit/test_rpc.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + import oslo_messaging as messaging from oslo_messaging.rpc import dispatcher from oslo_serialization import jsonutils diff --git a/nova/tests/unit/test_service.py b/nova/tests/unit/test_service.py index 04fa10d4c5..9fb6fa1c40 100644 --- a/nova/tests/unit/test_service.py +++ b/nova/tests/unit/test_service.py @@ -18,7 +18,8 @@ Unit Tests for remote procedure calls using queue """ -import mock +from unittest import mock + from oslo_concurrency import processutils from oslo_config import cfg from oslo_service import service as _service diff --git a/nova/tests/unit/test_service_auth.py b/nova/tests/unit/test_service_auth.py index db2a2e2899..5f07515188 100644 --- a/nova/tests/unit/test_service_auth.py +++ b/nova/tests/unit/test_service_auth.py @@ -10,9 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from keystoneauth1 import loading as ks_loading from keystoneauth1 import service_token -import mock from nova import context from nova import service_auth diff --git a/nova/tests/unit/test_test.py b/nova/tests/unit/test_test.py index 8381792de6..2088e68625 100644 --- a/nova/tests/unit/test_test.py +++ b/nova/tests/unit/test_test.py @@ -18,9 +18,9 @@ import os.path import tempfile +from unittest import mock import uuid -import mock from oslo_log import log as logging import oslo_messaging as messaging diff --git a/nova/tests/unit/test_utils.py b/nova/tests/unit/test_utils.py index bd69ccbb65..ca4e09b087 100644 --- a/nova/tests/unit/test_utils.py +++ b/nova/tests/unit/test_utils.py @@ -16,13 +16,13 @@ import datetime import os import os.path import tempfile +from unittest import mock import eventlet import fixtures from keystoneauth1 import adapter as ks_adapter from keystoneauth1.identity import base as ks_identity from keystoneauth1 import session as ks_session -import mock import netaddr from openstack import exceptions as sdk_exc from oslo_config import cfg diff --git a/nova/tests/unit/test_weights.py b/nova/tests/unit/test_weights.py index 5758e9aa2f..ad0a203ff4 100644 --- a/nova/tests/unit/test_weights.py +++ b/nova/tests/unit/test_weights.py @@ -16,7 +16,7 @@ Tests For weights. """ -import mock +from unittest import mock from nova.scheduler import weights as scheduler_weights from nova.scheduler.weights import ram diff --git a/nova/tests/unit/test_wsgi.py b/nova/tests/unit/test_wsgi.py index e46318cd17..45a0406b5c 100644 --- a/nova/tests/unit/test_wsgi.py +++ b/nova/tests/unit/test_wsgi.py @@ -19,10 +19,10 @@ import os.path import socket import tempfile +from unittest import mock import eventlet import eventlet.wsgi -import mock from oslo_config import cfg import requests import testtools diff --git a/nova/tests/unit/utils.py b/nova/tests/unit/utils.py index 6311475522..51edc45686 100644 --- a/nova/tests/unit/utils.py +++ b/nova/tests/unit/utils.py @@ -17,8 +17,7 @@ import errno import platform import socket import sys - -import mock +from unittest import mock from nova.compute import flavors import nova.conf diff --git a/nova/tests/unit/virt/disk/mount/test_api.py b/nova/tests/unit/virt/disk/mount/test_api.py index d51b2be8b0..7d8a741914 100644 --- a/nova/tests/unit/virt/disk/mount/test_api.py +++ b/nova/tests/unit/virt/disk/mount/test_api.py @@ -12,7 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_service import fixture as service_fixture from nova import test diff --git a/nova/tests/unit/virt/disk/mount/test_loop.py b/nova/tests/unit/virt/disk/mount/test_loop.py index 3c0c18fa60..312b88db35 100644 --- a/nova/tests/unit/virt/disk/mount/test_loop.py +++ b/nova/tests/unit/virt/disk/mount/test_loop.py @@ -14,8 +14,9 @@ # under the License. +from unittest import mock + import fixtures -import mock from nova import test from nova.virt.disk.mount import loop diff --git a/nova/tests/unit/virt/disk/mount/test_nbd.py b/nova/tests/unit/virt/disk/mount/test_nbd.py index 0024b2f6d6..cc0e04337e 100644 --- a/nova/tests/unit/virt/disk/mount/test_nbd.py +++ b/nova/tests/unit/virt/disk/mount/test_nbd.py @@ -14,10 +14,10 @@ # under the License. -import mock import os import tempfile import time +from unittest import mock import eventlet import fixtures diff --git a/nova/tests/unit/virt/disk/test_api.py b/nova/tests/unit/virt/disk/test_api.py index 5b90fd186e..62005de525 100644 --- a/nova/tests/unit/virt/disk/test_api.py +++ b/nova/tests/unit/virt/disk/test_api.py @@ -14,8 +14,8 @@ # under the License. import tempfile +from unittest import mock -import mock from oslo_concurrency import processutils from oslo_utils import units diff --git a/nova/tests/unit/virt/disk/vfs/test_guestfs.py b/nova/tests/unit/virt/disk/vfs/test_guestfs.py index b1c619c955..9dc937202a 100644 --- a/nova/tests/unit/virt/disk/vfs/test_guestfs.py +++ b/nova/tests/unit/virt/disk/vfs/test_guestfs.py @@ -13,9 +13,9 @@ # under the License. import collections +from unittest import mock import fixtures -import mock from nova import exception from nova import test diff --git a/nova/tests/unit/virt/hyperv/test_base.py b/nova/tests/unit/virt/hyperv/test_base.py index e895fc600e..1dd7db367b 100644 --- a/nova/tests/unit/virt/hyperv/test_base.py +++ b/nova/tests/unit/virt/hyperv/test_base.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from os_win import utilsfactory from nova import test diff --git a/nova/tests/unit/virt/hyperv/test_block_device_manager.py b/nova/tests/unit/virt/hyperv/test_block_device_manager.py index ded2ffa0d4..0d914a55a5 100644 --- a/nova/tests/unit/virt/hyperv/test_block_device_manager.py +++ b/nova/tests/unit/virt/hyperv/test_block_device_manager.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from os_win import constants as os_win_const +from unittest import mock from nova import exception from nova.tests.unit.virt.hyperv import test_base diff --git a/nova/tests/unit/virt/hyperv/test_driver.py b/nova/tests/unit/virt/hyperv/test_driver.py index 07f251390e..c9ccc6e8f1 100644 --- a/nova/tests/unit/virt/hyperv/test_driver.py +++ b/nova/tests/unit/virt/hyperv/test_driver.py @@ -19,8 +19,8 @@ Unit tests for the Hyper-V Driver. import platform import sys +from unittest import mock -import mock from os_win import exceptions as os_win_exc from nova import exception diff --git a/nova/tests/unit/virt/hyperv/test_eventhandler.py b/nova/tests/unit/virt/hyperv/test_eventhandler.py index 658a49c5c1..9825bc9141 100644 --- a/nova/tests/unit/virt/hyperv/test_eventhandler.py +++ b/nova/tests/unit/virt/hyperv/test_eventhandler.py @@ -13,10 +13,10 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from os_win import constants from os_win import exceptions as os_win_exc from os_win import utilsfactory +from unittest import mock from nova.tests.unit.virt.hyperv import test_base from nova import utils diff --git a/nova/tests/unit/virt/hyperv/test_hostops.py b/nova/tests/unit/virt/hyperv/test_hostops.py index ebe2979f8a..04434dd37e 100644 --- a/nova/tests/unit/virt/hyperv/test_hostops.py +++ b/nova/tests/unit/virt/hyperv/test_hostops.py @@ -14,8 +14,8 @@ # under the License. import datetime +from unittest import mock -import mock import os_resource_classes as orc from os_win import constants as os_win_const from oslo_config import cfg diff --git a/nova/tests/unit/virt/hyperv/test_imagecache.py b/nova/tests/unit/virt/hyperv/test_imagecache.py index 4c0c1318ae..827d52133d 100644 --- a/nova/tests/unit/virt/hyperv/test_imagecache.py +++ b/nova/tests/unit/virt/hyperv/test_imagecache.py @@ -14,10 +14,10 @@ # under the License. import os +from unittest import mock import ddt import fixtures -import mock from oslo_config import cfg from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import units diff --git a/nova/tests/unit/virt/hyperv/test_livemigrationops.py b/nova/tests/unit/virt/hyperv/test_livemigrationops.py index 8a3df843b9..79cb4318c5 100644 --- a/nova/tests/unit/virt/hyperv/test_livemigrationops.py +++ b/nova/tests/unit/virt/hyperv/test_livemigrationops.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from os_win import exceptions as os_win_exc +from unittest import mock + from oslo_config import cfg from nova import exception diff --git a/nova/tests/unit/virt/hyperv/test_migrationops.py b/nova/tests/unit/virt/hyperv/test_migrationops.py index 86844b11cf..d0b7ff32fd 100644 --- a/nova/tests/unit/virt/hyperv/test_migrationops.py +++ b/nova/tests/unit/virt/hyperv/test_migrationops.py @@ -13,8 +13,8 @@ # under the License. import os +from unittest import mock -import mock from os_win import exceptions as os_win_exc from oslo_utils import units diff --git a/nova/tests/unit/virt/hyperv/test_pathutils.py b/nova/tests/unit/virt/hyperv/test_pathutils.py index 573fe557a5..7bd9e91e3f 100644 --- a/nova/tests/unit/virt/hyperv/test_pathutils.py +++ b/nova/tests/unit/virt/hyperv/test_pathutils.py @@ -14,8 +14,7 @@ import os import time - -import mock +from unittest import mock from nova import exception from nova.tests.unit.virt.hyperv import test_base diff --git a/nova/tests/unit/virt/hyperv/test_rdpconsoleops.py b/nova/tests/unit/virt/hyperv/test_rdpconsoleops.py index ffc1e4cd0c..5e6bf9a3c3 100644 --- a/nova/tests/unit/virt/hyperv/test_rdpconsoleops.py +++ b/nova/tests/unit/virt/hyperv/test_rdpconsoleops.py @@ -17,7 +17,7 @@ Unit tests for the Hyper-V RDPConsoleOps. """ -import mock +from unittest import mock from nova.tests.unit.virt.hyperv import test_base from nova.virt.hyperv import rdpconsoleops diff --git a/nova/tests/unit/virt/hyperv/test_serialconsolehandler.py b/nova/tests/unit/virt/hyperv/test_serialconsolehandler.py index 4240b8eb95..e9461408c4 100644 --- a/nova/tests/unit/virt/hyperv/test_serialconsolehandler.py +++ b/nova/tests/unit/virt/hyperv/test_serialconsolehandler.py @@ -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.unit.virt.hyperv import test_base diff --git a/nova/tests/unit/virt/hyperv/test_serialconsoleops.py b/nova/tests/unit/virt/hyperv/test_serialconsoleops.py index 1e8a9c7557..4a4b7c8e4f 100644 --- a/nova/tests/unit/virt/hyperv/test_serialconsoleops.py +++ b/nova/tests/unit/virt/hyperv/test_serialconsoleops.py @@ -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.unit.virt.hyperv import test_base diff --git a/nova/tests/unit/virt/hyperv/test_serialproxy.py b/nova/tests/unit/virt/hyperv/test_serialproxy.py index 4d1cf80f80..b7e08a67dd 100644 --- a/nova/tests/unit/virt/hyperv/test_serialproxy.py +++ b/nova/tests/unit/virt/hyperv/test_serialproxy.py @@ -14,8 +14,8 @@ # under the License. import socket +from unittest import mock -import mock from nova import exception from nova.tests.unit.virt.hyperv import test_base diff --git a/nova/tests/unit/virt/hyperv/test_snapshotops.py b/nova/tests/unit/virt/hyperv/test_snapshotops.py index 60f5876296..1bb2f8dd4b 100644 --- a/nova/tests/unit/virt/hyperv/test_snapshotops.py +++ b/nova/tests/unit/virt/hyperv/test_snapshotops.py @@ -14,8 +14,8 @@ # under the License. import os +from unittest import mock -import mock from nova.compute import task_states from nova.tests.unit import fake_instance diff --git a/nova/tests/unit/virt/hyperv/test_vif.py b/nova/tests/unit/virt/hyperv/test_vif.py index c1f5951b79..d4c8d7af58 100644 --- a/nova/tests/unit/virt/hyperv/test_vif.py +++ b/nova/tests/unit/virt/hyperv/test_vif.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import nova.conf from nova import exception diff --git a/nova/tests/unit/virt/hyperv/test_vmops.py b/nova/tests/unit/virt/hyperv/test_vmops.py index 4065b0f7bb..cdca0f97eb 100644 --- a/nova/tests/unit/virt/hyperv/test_vmops.py +++ b/nova/tests/unit/virt/hyperv/test_vmops.py @@ -13,10 +13,10 @@ # under the License. import os +from unittest import mock import ddt from eventlet import timeout as etimeout -import mock from os_win import constants as os_win_const from os_win import exceptions as os_win_exc from oslo_concurrency import processutils diff --git a/nova/tests/unit/virt/hyperv/test_volumeops.py b/nova/tests/unit/virt/hyperv/test_volumeops.py index da7262085d..66d2c2527f 100644 --- a/nova/tests/unit/virt/hyperv/test_volumeops.py +++ b/nova/tests/unit/virt/hyperv/test_volumeops.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from os_brick.initiator import connector from oslo_config import cfg from oslo_utils import units diff --git a/nova/tests/unit/virt/ironic/test_client_wrapper.py b/nova/tests/unit/virt/ironic/test_client_wrapper.py index 9c2ffe3dca..512f1438d6 100644 --- a/nova/tests/unit/virt/ironic/test_client_wrapper.py +++ b/nova/tests/unit/virt/ironic/test_client_wrapper.py @@ -13,11 +13,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from ironicclient import client as ironic_client from ironicclient import exc as ironic_exception from keystoneauth1 import discover as ksa_disc import keystoneauth1.session -import mock from oslo_config import cfg import nova.conf diff --git a/nova/tests/unit/virt/ironic/test_driver.py b/nova/tests/unit/virt/ironic/test_driver.py index 7b377b21c2..439c15683c 100644 --- a/nova/tests/unit/virt/ironic/test_driver.py +++ b/nova/tests/unit/virt/ironic/test_driver.py @@ -15,9 +15,10 @@ """Tests for the ironic driver.""" +from unittest import mock + import fixtures from ironicclient import exc as ironic_exception -import mock from openstack import exceptions as sdk_exc from oslo_config import cfg from oslo_service import loopingcall diff --git a/nova/tests/unit/virt/libvirt/storage/test_dmcrypt.py b/nova/tests/unit/virt/libvirt/storage/test_dmcrypt.py index cd45bac54a..28c93e4855 100644 --- a/nova/tests/unit/virt/libvirt/storage/test_dmcrypt.py +++ b/nova/tests/unit/virt/libvirt/storage/test_dmcrypt.py @@ -14,7 +14,8 @@ # under the License. import binascii -import mock +from unittest import mock + from oslo_concurrency import processutils from nova import test diff --git a/nova/tests/unit/virt/libvirt/storage/test_lvm.py b/nova/tests/unit/virt/libvirt/storage/test_lvm.py index fbec2dcae9..04d9ffdcbf 100644 --- a/nova/tests/unit/virt/libvirt/storage/test_lvm.py +++ b/nova/tests/unit/virt/libvirt/storage/test_lvm.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_concurrency import processutils from oslo_config import cfg from oslo_utils import units diff --git a/nova/tests/unit/virt/libvirt/test_blockinfo.py b/nova/tests/unit/virt/libvirt/test_blockinfo.py index 7707f745e3..3da827dce8 100644 --- a/nova/tests/unit/virt/libvirt/test_blockinfo.py +++ b/nova/tests/unit/virt/libvirt/test_blockinfo.py @@ -14,9 +14,9 @@ # under the License. import copy +from unittest import mock import fixtures -import mock from oslo_utils.fixture import uuidsentinel as uuids from nova import block_device diff --git a/nova/tests/unit/virt/libvirt/test_designer.py b/nova/tests/unit/virt/libvirt/test_designer.py index a6ad7f9ccc..cb435286e9 100644 --- a/nova/tests/unit/virt/libvirt/test_designer.py +++ b/nova/tests/unit/virt/libvirt/test_designer.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.pci import utils as pci_utils from nova import test diff --git a/nova/tests/unit/virt/libvirt/test_driver.py b/nova/tests/unit/virt/libvirt/test_driver.py index 7bc5b34e5e..e8876ec7b6 100644 --- a/nova/tests/unit/virt/libvirt/test_driver.py +++ b/nova/tests/unit/virt/libvirt/test_driver.py @@ -31,6 +31,7 @@ import testtools import threading import time import unittest +from unittest import mock from castellan import key_manager import ddt @@ -38,7 +39,6 @@ import eventlet from eventlet import greenthread import fixtures from lxml import etree -import mock from os_brick import encryptors from os_brick import exception as brick_exception from os_brick.initiator import connector diff --git a/nova/tests/unit/virt/libvirt/test_guest.py b/nova/tests/unit/virt/libvirt/test_guest.py index 70d438d816..f662c108a9 100644 --- a/nova/tests/unit/virt/libvirt/test_guest.py +++ b/nova/tests/unit/virt/libvirt/test_guest.py @@ -14,7 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_service import fixture as service_fixture from oslo_utils import encodeutils diff --git a/nova/tests/unit/virt/libvirt/test_host.py b/nova/tests/unit/virt/libvirt/test_host.py index 7082c3ad95..07366ef028 100644 --- a/nova/tests/unit/virt/libvirt/test_host.py +++ b/nova/tests/unit/virt/libvirt/test_host.py @@ -15,12 +15,12 @@ # under the License. import os +from unittest import mock import ddt import eventlet from eventlet import greenthread from eventlet import tpool -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import uuidutils diff --git a/nova/tests/unit/virt/libvirt/test_imagebackend.py b/nova/tests/unit/virt/libvirt/test_imagebackend.py index decb27f982..fdac091985 100644 --- a/nova/tests/unit/virt/libvirt/test_imagebackend.py +++ b/nova/tests/unit/virt/libvirt/test_imagebackend.py @@ -19,11 +19,11 @@ import inspect import os import shutil import tempfile +from unittest import mock from castellan import key_manager import ddt import fixtures -import mock from oslo_concurrency import lockutils from oslo_config import fixture as config_fixture from oslo_service import loopingcall diff --git a/nova/tests/unit/virt/libvirt/test_imagecache.py b/nova/tests/unit/virt/libvirt/test_imagecache.py index f6e592231d..a005a6cf20 100644 --- a/nova/tests/unit/virt/libvirt/test_imagecache.py +++ b/nova/tests/unit/virt/libvirt/test_imagecache.py @@ -18,8 +18,8 @@ import contextlib import io import os import time +from unittest import mock -import mock from oslo_concurrency import lockutils from oslo_concurrency import processutils from oslo_log import formatters diff --git a/nova/tests/unit/virt/libvirt/test_machine_type_utils.py b/nova/tests/unit/virt/libvirt/test_machine_type_utils.py index 42043ac495..08c54d02d3 100644 --- a/nova/tests/unit/virt/libvirt/test_machine_type_utils.py +++ b/nova/tests/unit/virt/libvirt/test_machine_type_utils.py @@ -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.fixture import uuidsentinel from oslo_utils import uuidutils diff --git a/nova/tests/unit/virt/libvirt/test_migration.py b/nova/tests/unit/virt/libvirt/test_migration.py index 70488f88cf..155c259986 100644 --- a/nova/tests/unit/virt/libvirt/test_migration.py +++ b/nova/tests/unit/virt/libvirt/test_migration.py @@ -15,9 +15,9 @@ from collections import deque import copy import textwrap +from unittest import mock from lxml import etree -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import units diff --git a/nova/tests/unit/virt/libvirt/test_utils.py b/nova/tests/unit/virt/libvirt/test_utils.py index 4e73c662c5..8c24f3fb92 100644 --- a/nova/tests/unit/virt/libvirt/test_utils.py +++ b/nova/tests/unit/virt/libvirt/test_utils.py @@ -18,9 +18,9 @@ import grp import os import pwd import tempfile +from unittest import mock import ddt -import mock import os_traits from oslo_config import cfg from oslo_utils import fileutils diff --git a/nova/tests/unit/virt/libvirt/test_vif.py b/nova/tests/unit/virt/libvirt/test_vif.py index 4710f5226e..d89aa279d8 100644 --- a/nova/tests/unit/virt/libvirt/test_vif.py +++ b/nova/tests/unit/virt/libvirt/test_vif.py @@ -12,9 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import fixtures from lxml import etree -import mock import os_vif from os_vif import exception as osv_exception from os_vif import objects as osv_objects diff --git a/nova/tests/unit/virt/libvirt/volume/test_fibrechannel.py b/nova/tests/unit/virt/libvirt/volume/test_fibrechannel.py index 89a59f2f1a..06065322f6 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_fibrechannel.py +++ b/nova/tests/unit/virt/libvirt/volume/test_fibrechannel.py @@ -11,8 +11,8 @@ # under the License. import platform +from unittest import mock -import mock from os_brick.initiator import connector from nova.objects import fields as obj_fields diff --git a/nova/tests/unit/virt/libvirt/volume/test_fs.py b/nova/tests/unit/virt/libvirt/volume/test_fs.py index eaa6568999..5619dff589 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_fs.py +++ b/nova/tests/unit/virt/libvirt/volume/test_fs.py @@ -13,8 +13,8 @@ # under the License. import os +from unittest import mock -import mock from nova import test from nova import utils diff --git a/nova/tests/unit/virt/libvirt/volume/test_iscsi.py b/nova/tests/unit/virt/libvirt/volume/test_iscsi.py index f8a64abea5..bd516b1dd6 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_iscsi.py +++ b/nova/tests/unit/virt/libvirt/volume/test_iscsi.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from os_brick import exception as os_brick_exception from os_brick.initiator import connector +from unittest import mock from nova.tests.unit.virt.libvirt.volume import test_volume from nova.virt.libvirt.volume import iscsi diff --git a/nova/tests/unit/virt/libvirt/volume/test_lightos.py b/nova/tests/unit/virt/libvirt/volume/test_lightos.py index 554647acf4..21ea13b292 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_lightos.py +++ b/nova/tests/unit/virt/libvirt/volume/test_lightos.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.tests.unit.virt.libvirt.volume import test_volume from nova.virt.libvirt.volume import lightos diff --git a/nova/tests/unit/virt/libvirt/volume/test_mount.py b/nova/tests/unit/virt/libvirt/volume/test_mount.py index b618e090ba..8ecb117f05 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_mount.py +++ b/nova/tests/unit/virt/libvirt/volume/test_mount.py @@ -15,10 +15,10 @@ import os.path import threading import time +from unittest import mock import eventlet import fixtures -import mock from oslo_concurrency import processutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/virt/libvirt/volume/test_net.py b/nova/tests/unit/virt/libvirt/volume/test_net.py index a694351629..8d8167b3d7 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_net.py +++ b/nova/tests/unit/virt/libvirt/volume/test_net.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock import nova.conf from nova.tests.unit.virt.libvirt.volume import test_volume diff --git a/nova/tests/unit/virt/libvirt/volume/test_nfs.py b/nova/tests/unit/virt/libvirt/volume/test_nfs.py index 16c41f5387..a98efaac1c 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_nfs.py +++ b/nova/tests/unit/virt/libvirt/volume/test_nfs.py @@ -11,8 +11,8 @@ # under the License. import os +from unittest import mock -import mock from oslo_utils.fixture import uuidsentinel as uuids from nova.tests.unit.virt.libvirt.volume import test_mount diff --git a/nova/tests/unit/virt/libvirt/volume/test_nvme.py b/nova/tests/unit/virt/libvirt/volume/test_nvme.py index fcb303b4c3..5d4fc47625 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_nvme.py +++ b/nova/tests/unit/virt/libvirt/volume/test_nvme.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.tests.unit.virt.libvirt.volume import test_volume from nova.virt.libvirt.volume import nvme diff --git a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py index 8a0c647fc8..bb3c86083c 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_quobyte.py +++ b/nova/tests/unit/virt/libvirt/volume/test_quobyte.py @@ -16,9 +16,9 @@ import os import traceback +from unittest import mock import ddt -import mock from oslo_concurrency import processutils from oslo_utils import fileutils import psutil diff --git a/nova/tests/unit/virt/libvirt/volume/test_remotefs.py b/nova/tests/unit/virt/libvirt/volume/test_remotefs.py index 62060bcf1e..67c126c2b1 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_remotefs.py +++ b/nova/tests/unit/virt/libvirt/volume/test_remotefs.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_concurrency import processutils from nova import test diff --git a/nova/tests/unit/virt/libvirt/volume/test_scaleio.py b/nova/tests/unit/virt/libvirt/volume/test_scaleio.py index 6d9247cd2d..f0fcba1deb 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_scaleio.py +++ b/nova/tests/unit/virt/libvirt/volume/test_scaleio.py @@ -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.unit.virt.libvirt.volume import test_volume from nova.virt.libvirt.volume import scaleio diff --git a/nova/tests/unit/virt/libvirt/volume/test_smbfs.py b/nova/tests/unit/virt/libvirt/volume/test_smbfs.py index 2c3ea574a9..0fba137740 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_smbfs.py +++ b/nova/tests/unit/virt/libvirt/volume/test_smbfs.py @@ -11,8 +11,8 @@ # under the License. import os +from unittest import mock -import mock from nova.tests.unit.virt.libvirt.volume import test_volume from nova import utils diff --git a/nova/tests/unit/virt/libvirt/volume/test_storpool.py b/nova/tests/unit/virt/libvirt/volume/test_storpool.py index e14954f148..678d4f8eb4 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_storpool.py +++ b/nova/tests/unit/virt/libvirt/volume/test_storpool.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from os_brick import initiator +from unittest import mock from nova.tests.unit.virt.libvirt.volume import test_volume from nova.virt.libvirt.volume import storpool as vol_sp diff --git a/nova/tests/unit/virt/libvirt/volume/test_volume.py b/nova/tests/unit/virt/libvirt/volume/test_volume.py index ac7bcf247d..9a3710a51d 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_volume.py +++ b/nova/tests/unit/virt/libvirt/volume/test_volume.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from oslo_utils.fixture import uuidsentinel as uuids from nova import exception diff --git a/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py b/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py index 883cebb55a..168efee944 100644 --- a/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py +++ b/nova/tests/unit/virt/libvirt/volume/test_vzstorage.py @@ -11,8 +11,8 @@ # under the License. import os +from unittest import mock -import mock from os_brick.initiator import connector from nova import exception diff --git a/nova/tests/unit/virt/powervm/disk/test_driver.py b/nova/tests/unit/virt/powervm/disk/test_driver.py index c27825801f..b15ef2a9e4 100644 --- a/nova/tests/unit/virt/powervm/disk/test_driver.py +++ b/nova/tests/unit/virt/powervm/disk/test_driver.py @@ -14,8 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import fixtures -import mock from pypowervm import const as pvm_const from nova import test diff --git a/nova/tests/unit/virt/powervm/disk/test_localdisk.py b/nova/tests/unit/virt/powervm/disk/test_localdisk.py index 25b8395bb2..55010db367 100644 --- a/nova/tests/unit/virt/powervm/disk/test_localdisk.py +++ b/nova/tests/unit/virt/powervm/disk/test_localdisk.py @@ -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 nova import exception from nova import test diff --git a/nova/tests/unit/virt/powervm/disk/test_ssp.py b/nova/tests/unit/virt/powervm/disk/test_ssp.py index 86705dc29b..ddb1265c8d 100644 --- a/nova/tests/unit/virt/powervm/disk/test_ssp.py +++ b/nova/tests/unit/virt/powervm/disk/test_ssp.py @@ -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 uuidutils from pypowervm import const as pvm_const from pypowervm import exceptions as pvm_exc diff --git a/nova/tests/unit/virt/powervm/tasks/test_image.py b/nova/tests/unit/virt/powervm/tasks/test_image.py index b9e3560a16..5b897e8e4a 100644 --- a/nova/tests/unit/virt/powervm/tasks/test_image.py +++ b/nova/tests/unit/virt/powervm/tasks/test_image.py @@ -14,7 +14,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova import test diff --git a/nova/tests/unit/virt/powervm/tasks/test_network.py b/nova/tests/unit/virt/powervm/tasks/test_network.py index 9d6951eceb..f47a7e0b18 100644 --- a/nova/tests/unit/virt/powervm/tasks/test_network.py +++ b/nova/tests/unit/virt/powervm/tasks/test_network.py @@ -15,9 +15,9 @@ # under the License. import copy +from unittest import mock import eventlet -import mock from pypowervm.wrappers import network as pvm_net from nova import exception diff --git a/nova/tests/unit/virt/powervm/tasks/test_storage.py b/nova/tests/unit/virt/powervm/tasks/test_storage.py index 39fe9dec72..2c4623262d 100644 --- a/nova/tests/unit/virt/powervm/tasks/test_storage.py +++ b/nova/tests/unit/virt/powervm/tasks/test_storage.py @@ -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 pypowervm import exceptions as pvm_exc from nova import exception diff --git a/nova/tests/unit/virt/powervm/tasks/test_vm.py b/nova/tests/unit/virt/powervm/tasks/test_vm.py index fc68646acf..4eb573139c 100644 --- a/nova/tests/unit/virt/powervm/tasks/test_vm.py +++ b/nova/tests/unit/virt/powervm/tasks/test_vm.py @@ -12,10 +12,10 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from taskflow import engines as tf_eng from taskflow.patterns import linear_flow as tf_lf from taskflow import task as tf_tsk +from unittest import mock from nova import exception from nova import test diff --git a/nova/tests/unit/virt/powervm/test_driver.py b/nova/tests/unit/virt/powervm/test_driver.py index 025d823d15..8acbd70ed9 100644 --- a/nova/tests/unit/virt/powervm/test_driver.py +++ b/nova/tests/unit/virt/powervm/test_driver.py @@ -13,9 +13,9 @@ # under the License. import contextlib +from unittest import mock import fixtures -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from pypowervm import const as pvm_const diff --git a/nova/tests/unit/virt/powervm/test_host.py b/nova/tests/unit/virt/powervm/test_host.py index 625e1f9c70..5ca19e07d1 100644 --- a/nova/tests/unit/virt/powervm/test_host.py +++ b/nova/tests/unit/virt/powervm/test_host.py @@ -13,8 +13,8 @@ # under the License. # -import mock from pypowervm.wrappers import managed_system as pvm_ms +from unittest import mock from nova import test from nova.virt.powervm import host as pvm_host diff --git a/nova/tests/unit/virt/powervm/test_image.py b/nova/tests/unit/virt/powervm/test_image.py index 2db33e6a0f..70f6301804 100644 --- a/nova/tests/unit/virt/powervm/test_image.py +++ b/nova/tests/unit/virt/powervm/test_image.py @@ -14,7 +14,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.virt.powervm import image diff --git a/nova/tests/unit/virt/powervm/test_media.py b/nova/tests/unit/virt/powervm/test_media.py index f98769e0de..70891d873a 100644 --- a/nova/tests/unit/virt/powervm/test_media.py +++ b/nova/tests/unit/virt/powervm/test_media.py @@ -14,8 +14,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 from pypowervm import const as pvm_const from pypowervm.tasks import scsi_mapper as tsk_map diff --git a/nova/tests/unit/virt/powervm/test_mgmt.py b/nova/tests/unit/virt/powervm/test_mgmt.py index 5c0098ceeb..30c7e8a47a 100644 --- a/nova/tests/unit/virt/powervm/test_mgmt.py +++ b/nova/tests/unit/virt/powervm/test_mgmt.py @@ -14,8 +14,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock import retrying +from unittest import mock from nova import exception from nova import test diff --git a/nova/tests/unit/virt/powervm/test_vif.py b/nova/tests/unit/virt/powervm/test_vif.py index 985c48abe5..3f75186138 100644 --- a/nova/tests/unit/virt/powervm/test_vif.py +++ b/nova/tests/unit/virt/powervm/test_vif.py @@ -14,9 +14,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from pypowervm import exceptions as pvm_ex from pypowervm.wrappers import network as pvm_net +from unittest import mock from nova import exception from nova.network import model diff --git a/nova/tests/unit/virt/powervm/test_vm.py b/nova/tests/unit/virt/powervm/test_vm.py index ab0f9c35e8..5b7cb3ce56 100644 --- a/nova/tests/unit/virt/powervm/test_vm.py +++ b/nova/tests/unit/virt/powervm/test_vm.py @@ -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 pypowervm import exceptions as pvm_exc from pypowervm.helpers import log_helper as pvm_log from pypowervm.tests import test_fixtures as pvm_fx diff --git a/nova/tests/unit/virt/powervm/volume/test_fcvscsi.py b/nova/tests/unit/virt/powervm/volume/test_fcvscsi.py index 2db5b1a663..d2358a3bbb 100644 --- a/nova/tests/unit/virt/powervm/volume/test_fcvscsi.py +++ b/nova/tests/unit/virt/powervm/volume/test_fcvscsi.py @@ -14,13 +14,13 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from pypowervm import const as pvm_const from pypowervm.tasks import hdisk from pypowervm.tests import test_fixtures as pvm_fx from pypowervm.utils import transaction as pvm_tx from pypowervm.wrappers import storage as pvm_stor from pypowervm.wrappers import virtual_io_server as pvm_vios +from unittest import mock from nova import conf as cfg from nova import exception as exc diff --git a/nova/tests/unit/virt/test_block_device.py b/nova/tests/unit/virt/test_block_device.py index b5fca28463..890a8f166a 100644 --- a/nova/tests/unit/virt/test_block_device.py +++ b/nova/tests/unit/virt/test_block_device.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -import mock from os_brick import encryptors +from unittest import mock + from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids diff --git a/nova/tests/unit/virt/test_hardware.py b/nova/tests/unit/virt/test_hardware.py index 1e98dfba6a..3954e8d805 100644 --- a/nova/tests/unit/virt/test_hardware.py +++ b/nova/tests/unit/virt/test_hardware.py @@ -14,9 +14,9 @@ import collections import copy -import ddt +from unittest import mock -import mock +import ddt import testtools import nova.conf diff --git a/nova/tests/unit/virt/test_imagecache.py b/nova/tests/unit/virt/test_imagecache.py index b9dff7f6b6..b97e520074 100644 --- a/nova/tests/unit/virt/test_imagecache.py +++ b/nova/tests/unit/virt/test_imagecache.py @@ -12,7 +12,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 import block_device diff --git a/nova/tests/unit/virt/test_images.py b/nova/tests/unit/virt/test_images.py index 085b169db3..58581d93ba 100644 --- a/nova/tests/unit/virt/test_images.py +++ b/nova/tests/unit/virt/test_images.py @@ -13,8 +13,8 @@ # under the License. import os +from unittest import mock -import mock from oslo_concurrency import processutils from nova.compute import utils as compute_utils diff --git a/nova/tests/unit/virt/test_osinfo.py b/nova/tests/unit/virt/test_osinfo.py index af3698b541..5d927deab1 100644 --- a/nova/tests/unit/virt/test_osinfo.py +++ b/nova/tests/unit/virt/test_osinfo.py @@ -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 nova import exception from nova import objects diff --git a/nova/tests/unit/virt/test_virt.py b/nova/tests/unit/virt/test_virt.py index 11f306c761..935af880bc 100644 --- a/nova/tests/unit/virt/test_virt.py +++ b/nova/tests/unit/virt/test_virt.py @@ -14,8 +14,8 @@ # under the License. import io +from unittest import mock -import mock import os_traits from nova import test diff --git a/nova/tests/unit/virt/test_virt_drivers.py b/nova/tests/unit/virt/test_virt_drivers.py index 32d5ef2911..58fa3d4c27 100644 --- a/nova/tests/unit/virt/test_virt_drivers.py +++ b/nova/tests/unit/virt/test_virt_drivers.py @@ -15,9 +15,9 @@ from collections import deque import sys import traceback +from unittest import mock import fixtures -import mock import netaddr import os_resource_classes as orc import os_vif diff --git a/nova/tests/unit/virt/vmwareapi/test_configdrive.py b/nova/tests/unit/virt/vmwareapi/test_configdrive.py index de07444ddb..7e8b1c1b63 100644 --- a/nova/tests/unit/virt/vmwareapi/test_configdrive.py +++ b/nova/tests/unit/virt/vmwareapi/test_configdrive.py @@ -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 from nova import context diff --git a/nova/tests/unit/virt/vmwareapi/test_driver_api.py b/nova/tests/unit/virt/vmwareapi/test_driver_api.py index 7b31b24167..e2a321b50b 100644 --- a/nova/tests/unit/virt/vmwareapi/test_driver_api.py +++ b/nova/tests/unit/virt/vmwareapi/test_driver_api.py @@ -21,9 +21,9 @@ Test suite for VMwareAPI. import collections import datetime +from unittest import mock from eventlet import greenthread -import mock import os_resource_classes as orc from oslo_utils import fixture as utils_fixture from oslo_utils.fixture import uuidsentinel diff --git a/nova/tests/unit/virt/vmwareapi/test_ds_util.py b/nova/tests/unit/virt/vmwareapi/test_ds_util.py index 3b909642fb..1716027afb 100644 --- a/nova/tests/unit/virt/vmwareapi/test_ds_util.py +++ b/nova/tests/unit/virt/vmwareapi/test_ds_util.py @@ -14,8 +14,8 @@ from contextlib import contextmanager import re +from unittest import mock -import mock from oslo_utils import units from oslo_vmware import exceptions as vexc from oslo_vmware.objects import datastore as ds_obj diff --git a/nova/tests/unit/virt/vmwareapi/test_imagecache.py b/nova/tests/unit/virt/vmwareapi/test_imagecache.py index 485b1ea4cd..1116804d2f 100644 --- a/nova/tests/unit/virt/vmwareapi/test_imagecache.py +++ b/nova/tests/unit/virt/vmwareapi/test_imagecache.py @@ -13,8 +13,8 @@ # under the License. import datetime +from unittest import mock -import mock from oslo_config import cfg from oslo_utils import fixture as utils_fixture from oslo_utils.fixture import uuidsentinel diff --git a/nova/tests/unit/virt/vmwareapi/test_images.py b/nova/tests/unit/virt/vmwareapi/test_images.py index 7cfec00c97..6faf7491d6 100644 --- a/nova/tests/unit/virt/vmwareapi/test_images.py +++ b/nova/tests/unit/virt/vmwareapi/test_images.py @@ -17,8 +17,8 @@ Test suite for images. import os import tarfile +from unittest import mock -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import units from oslo_vmware import rw_handles diff --git a/nova/tests/unit/virt/vmwareapi/test_network_util.py b/nova/tests/unit/virt/vmwareapi/test_network_util.py index b5b2bd7281..b3b5bb15ea 100644 --- a/nova/tests/unit/virt/vmwareapi/test_network_util.py +++ b/nova/tests/unit/virt/vmwareapi/test_network_util.py @@ -15,8 +15,8 @@ # under the License. import collections +from unittest import mock -import mock from oslo_vmware import vim_util from nova import test diff --git a/nova/tests/unit/virt/vmwareapi/test_session.py b/nova/tests/unit/virt/vmwareapi/test_session.py index e4cb361764..6088e1f5b2 100644 --- a/nova/tests/unit/virt/vmwareapi/test_session.py +++ b/nova/tests/unit/virt/vmwareapi/test_session.py @@ -21,7 +21,7 @@ Test suite for VMwareAPI Session """ -import mock +from unittest import mock from oslo_vmware import exceptions as vexec diff --git a/nova/tests/unit/virt/vmwareapi/test_vif.py b/nova/tests/unit/virt/vmwareapi/test_vif.py index b0fb9df47c..02d516fac7 100644 --- a/nova/tests/unit/virt/vmwareapi/test_vif.py +++ b/nova/tests/unit/virt/vmwareapi/test_vif.py @@ -13,7 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock + from oslo_vmware import vim_util from nova import exception diff --git a/nova/tests/unit/virt/vmwareapi/test_vm_util.py b/nova/tests/unit/virt/vmwareapi/test_vm_util.py index 92e1434f44..82fa07a882 100644 --- a/nova/tests/unit/virt/vmwareapi/test_vm_util.py +++ b/nova/tests/unit/virt/vmwareapi/test_vm_util.py @@ -15,8 +15,8 @@ # under the License. import collections +from unittest import mock -import mock from oslo_service import fixture as oslo_svc_fixture from oslo_utils import units from oslo_utils import uuidutils diff --git a/nova/tests/unit/virt/vmwareapi/test_vmops.py b/nova/tests/unit/virt/vmwareapi/test_vmops.py index 61a4c15769..19990b8b32 100644 --- a/nova/tests/unit/virt/vmwareapi/test_vmops.py +++ b/nova/tests/unit/virt/vmwareapi/test_vmops.py @@ -14,8 +14,8 @@ # under the License. import time +from unittest import mock -import mock from oslo_serialization import jsonutils from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import units diff --git a/nova/tests/unit/virt/vmwareapi/test_volumeops.py b/nova/tests/unit/virt/vmwareapi/test_volumeops.py index 81e86aa948..003cbb9283 100644 --- a/nova/tests/unit/virt/vmwareapi/test_volumeops.py +++ b/nova/tests/unit/virt/vmwareapi/test_volumeops.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import ddt -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_vmware import exceptions as oslo_vmw_exceptions from oslo_vmware import vim_util as vutil diff --git a/nova/tests/unit/virt/zvm/test_driver.py b/nova/tests/unit/virt/zvm/test_driver.py index 85a8a5227c..a5a129331d 100644 --- a/nova/tests/unit/virt/zvm/test_driver.py +++ b/nova/tests/unit/virt/zvm/test_driver.py @@ -13,8 +13,9 @@ # under the License. import copy -import mock import os +from unittest import mock + from oslo_utils.fixture import uuidsentinel from nova.compute import provider_tree diff --git a/nova/tests/unit/virt/zvm/test_guest.py b/nova/tests/unit/virt/zvm/test_guest.py index 029f211ea4..c786270715 100644 --- a/nova/tests/unit/virt/zvm/test_guest.py +++ b/nova/tests/unit/virt/zvm/test_guest.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from nova.compute import power_state as compute_power_state from nova import context diff --git a/nova/tests/unit/virt/zvm/test_hypervisor.py b/nova/tests/unit/virt/zvm/test_hypervisor.py index d2081d49e2..c816ca57f6 100644 --- a/nova/tests/unit/virt/zvm/test_hypervisor.py +++ b/nova/tests/unit/virt/zvm/test_hypervisor.py @@ -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 diff --git a/nova/tests/unit/virt/zvm/test_utils.py b/nova/tests/unit/virt/zvm/test_utils.py index 60893759b9..77747855f4 100644 --- a/nova/tests/unit/virt/zvm/test_utils.py +++ b/nova/tests/unit/virt/zvm/test_utils.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from zvmconnector import connector diff --git a/nova/tests/unit/volume/test_cinder.py b/nova/tests/unit/volume/test_cinder.py index f4ee7383d4..e53ebe3cb8 100644 --- a/nova/tests/unit/volume/test_cinder.py +++ b/nova/tests/unit/volume/test_cinder.py @@ -13,13 +13,14 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from cinderclient import api_versions as cinder_api_versions from cinderclient import exceptions as cinder_exception from cinderclient.v3 import limits as cinder_limits from keystoneauth1 import loading as ks_loading from keystoneauth1 import session from keystoneclient import exceptions as keystone_exception -import mock from oslo_utils.fixture import uuidsentinel as uuids from oslo_utils import timeutils |