Use unittest.mock instead of third party mock

Now that we no longer support py27, we can use the standard library
unittest.mock module instead of the third party mock lib.

Change-Id: I4d8eada1df0ec43162d4729bf75147eb40252b72
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
This commit is contained in:
Sean McGinnis 2020-03-31 13:51:21 -05:00
parent d16593eb10
commit c9c34169de
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8
13 changed files with 22 additions and 41 deletions

View File

@ -22,7 +22,6 @@ linecache2==1.0.0
lxml==3.4.1 lxml==3.4.1
MarkupSafe==1.0 MarkupSafe==1.0
mccabe==0.2.1 mccabe==0.2.1
mock==2.0.0
netaddr==0.7.18 netaddr==0.7.18
netifaces==0.10.4 netifaces==0.10.4
openstackdocstheme==1.20.0 openstackdocstheme==1.20.0

View File

@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from oslo_vmware.objects import datacenter from oslo_vmware.objects import datacenter
from oslo_vmware.tests import base from oslo_vmware.tests import base

View File

@ -12,7 +12,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
import mock from unittest import mock
from oslo_utils import units from oslo_utils import units
import urllib.parse as urlparse import urllib.parse as urlparse

View File

@ -14,16 +14,15 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for session management and API invocation classes."""
Unit tests for session management and API invocation classes.
"""
from datetime import datetime from datetime import datetime
from unittest import mock
from eventlet import greenthread from eventlet import greenthread
import mock from oslo_context import context
import suds import suds
from oslo_context import context
from oslo_vmware import api from oslo_vmware import api
from oslo_vmware import exceptions from oslo_vmware import exceptions
from oslo_vmware import pbm from oslo_vmware import pbm

View File

@ -13,13 +13,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for VMware DVS utility module."""
Unit tests for VMware DVS utility module.
"""
import collections import collections
from unittest import mock
import mock
from oslo_vmware import dvs_util from oslo_vmware import dvs_util
from oslo_vmware.tests import base from oslo_vmware.tests import base

View File

@ -13,10 +13,8 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for exceptions module."""
Unit tests for exceptions module. from unittest import mock
"""
import mock
from oslo_vmware._i18n import _ from oslo_vmware._i18n import _
from oslo_vmware import exceptions from oslo_vmware import exceptions

View File

@ -13,13 +13,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for functions and classes for image transfer."""
Unit tests for functions and classes for image transfer.
"""
import io import io
from unittest import mock
import mock
from oslo_vmware import exceptions from oslo_vmware import exceptions
from oslo_vmware import image_transfer from oslo_vmware import image_transfer

View File

@ -13,13 +13,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for PBM utility methods."""
Unit tests for PBM utility methods.
"""
import os import os
from unittest import mock
import mock
import urllib.parse as urlparse import urllib.parse as urlparse
import urllib.request as urllib import urllib.request as urllib

View File

@ -13,13 +13,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for read and write handles for image transfer."""
Unit tests for read and write handles for image transfer.
"""
import ssl import ssl
from unittest import mock
import mock
import requests import requests
from oslo_vmware import exceptions from oslo_vmware import exceptions

View File

@ -15,9 +15,9 @@
import http.client as httplib import http.client as httplib
import io import io
from unittest import mock
import ddt import ddt
import mock
import requests import requests
import suds import suds

View File

@ -13,13 +13,11 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for classes to invoke VMware VI SOAP calls."""
Unit tests for classes to invoke VMware VI SOAP calls.
"""
import copy import copy
from unittest import mock
import mock
from oslo_i18n import fixture as i18n_fixture from oslo_i18n import fixture as i18n_fixture
import suds import suds

View File

@ -13,13 +13,10 @@
# License for the specific language governing permissions and limitations # License for the specific language governing permissions and limitations
# under the License. # under the License.
""" """Unit tests for VMware API utility module."""
Unit tests for VMware API utility module.
"""
import collections import collections
from unittest import mock
import mock
from oslo_vmware.tests import base from oslo_vmware.tests import base
from oslo_vmware import vim_util from oslo_vmware import vim_util

View File

@ -6,7 +6,6 @@
hacking>=3.0,<3.1.0 # Apache-2.0 hacking>=3.0,<3.1.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
testtools>=2.2.0 # MIT testtools>=2.2.0 # MIT
stestr>=2.0.0 # Apache-2.0 stestr>=2.0.0 # Apache-2.0