Merge "Use unittest.mock instead of third party mock"

This commit is contained in:
Zuul 2020-04-13 10:32:18 +00:00 committed by Gerrit Code Review
commit 7becea190a
25 changed files with 36 additions and 35 deletions

View File

@ -23,10 +23,10 @@ inline callbacks.
import eventlet
eventlet.monkey_patch(os=False)
import inspect
from unittest import mock
import fixtures
import inspect
import mock
from nova.tests import fixtures as nova_fixtures
from nova.tests.unit import conf_fixture
from nova.tests.unit import policy_fixture
@ -130,7 +130,6 @@ class NoDBTestCase(base.BaseTestCase):
def patch(self, path, *args, **kwargs):
patcher = mock.patch(path, *args, **kwargs)
result = patcher.start()
self.addCleanup(patcher.stop)
return result
def assertPublicAPISignatures(self, baseinst, inst):

View File

@ -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 nova.compute import power_state
from nova.compute import task_states
from nova.compute import vm_states

View File

@ -15,7 +15,7 @@
"""Unit tests for the Hyper-V Cluster Driver."""
import mock
from unittest import mock
from nova import safe_utils
from nova.virt import driver as nova_base_driver

View File

@ -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 nova.compute import vm_states
from nova import exception
from nova import test as nova_test

View File

@ -13,9 +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.
from unittest import mock
import eventlet.hubs as hubs
import mock
import monotonic
from os_win import utilsfactory
from oslo_utils import importutils

View File

@ -13,9 +13,9 @@
# under the License.
import os
from unittest import mock
import ddt
import mock
from nova import block_device
from nova import exception
from nova import objects

View File

@ -14,8 +14,8 @@
# under the License.
import inspect
from unittest import mock
import mock
import tooz.coordination
import tooz.locking

View File

@ -13,14 +13,12 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Unit tests for the Hyper-V Driver.
"""
"""Unit tests for the Hyper-V Driver."""
import platform
import sys
from unittest import mock
import mock
from nova import exception
from nova.image import glance
from nova import safe_utils

View File

@ -12,9 +12,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import ddt
import mock
from nova import utils
from os_win import constants

View File

@ -14,8 +14,8 @@
# under the License.
import datetime
from unittest import mock
import mock
from nova import context as nova_context
from nova import exception
from nova import objects

View File

@ -14,10 +14,10 @@
# under the License.
import os
from unittest import mock
import ddt
import fixtures
import mock
from nova import exception
from nova import objects
from nova.tests.unit.objects import test_flavor

View File

@ -12,9 +12,9 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import ddt
import mock
from nova import exception
from nova.objects import migrate_data as migrate_data_obj
from os_win import exceptions as os_win_exc

View File

@ -13,9 +13,9 @@
# under the License.
import os
from unittest import mock
import ddt
import mock
from nova import block_device
from nova import exception
from nova.virt import driver

View File

@ -14,9 +14,9 @@
import os
import time
from unittest import mock
import ddt
import mock
from nova import exception
from os_win import exceptions as os_win_exc
from oslo_utils import fileutils

View File

@ -13,12 +13,13 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from nova import exception
from six.moves import builtins
from compute_hyperv.nova import pdk
from compute_hyperv.tests.unit import test_base
from six.moves import builtins
class PDKTestCase(test_base.HyperVBaseTestCase):

View File

@ -13,11 +13,9 @@
# License for the specific language governing permissions and limitations
# under the License.
"""
Unit tests for the Hyper-V RDPConsoleOps.
"""
"""Unit tests for the Hyper-V RDPConsoleOps."""
import mock
from unittest import mock
from compute_hyperv.nova import rdpconsoleops
from compute_hyperv.tests.unit import test_base

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from nova import exception
from compute_hyperv.nova import constants

View File

@ -13,7 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from unittest import mock
from nova import exception
from six.moves import builtins

View File

@ -13,9 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.
import mock
from nova import exception
import socket
from unittest import mock
from nova import exception
from compute_hyperv.nova import serialproxy
from compute_hyperv.tests.unit import test_base

View File

@ -14,8 +14,8 @@
# under the License.
import os
from unittest import mock
import mock
from nova.compute import task_states
from nova import exception
from os_win import exceptions as os_win_exc

View File

@ -13,9 +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.
from unittest import mock
import ddt
import mock
from nova import exception
from nova.network import model
from os_win import constants as os_win_const

View File

@ -13,10 +13,10 @@
# under the License.
import os
from unittest import mock
import ddt
from eventlet import timeout as etimeout
import mock
from nova.compute import task_states
from nova.compute import vm_states
from nova import exception

View File

@ -16,9 +16,9 @@
import contextlib
import os
from unittest import mock
import ddt
import mock
from nova.compute import task_states
from nova import exception
from nova import test

View File

@ -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 nova import context
from nova import exception
from nova import objects

View File

@ -27,7 +27,6 @@ keystoneauth1==3.4.0
linecache2==1.0.0
MarkupSafe==1.0
mccabe==0.2.1
mock==2.0.0
monotonic==1.4
mox3==0.25.0
msgpack==0.5.6