Browse Source

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>
tags/3.3.1^0
Sean McGinnis 3 months ago
parent
commit
c9c34169de
No known key found for this signature in database GPG Key ID: CE7EE4BFAF8D70C8
13 changed files with 22 additions and 41 deletions
  1. +0
    -1
      lower-constraints.txt
  2. +1
    -1
      oslo_vmware/tests/objects/test_datacenter.py
  3. +2
    -1
      oslo_vmware/tests/objects/test_datastore.py
  4. +4
    -5
      oslo_vmware/tests/test_api.py
  5. +2
    -5
      oslo_vmware/tests/test_dvs_util.py
  6. +2
    -4
      oslo_vmware/tests/test_exceptions.py
  7. +2
    -5
      oslo_vmware/tests/test_image_transfer.py
  8. +2
    -4
      oslo_vmware/tests/test_pbm.py
  9. +2
    -4
      oslo_vmware/tests/test_rw_handles.py
  10. +1
    -1
      oslo_vmware/tests/test_service.py
  11. +2
    -4
      oslo_vmware/tests/test_vim.py
  12. +2
    -5
      oslo_vmware/tests/test_vim_util.py
  13. +0
    -1
      test-requirements.txt

+ 0
- 1
lower-constraints.txt View File

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


+ 1
- 1
oslo_vmware/tests/objects/test_datacenter.py View File

@@ -12,7 +12,7 @@
# License for the specific language governing permissions and limitations
# under the License.

import mock
from unittest import mock

from oslo_vmware.objects import datacenter
from oslo_vmware.tests import base


+ 2
- 1
oslo_vmware/tests/objects/test_datastore.py View File

@@ -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 units
import urllib.parse as urlparse



+ 4
- 5
oslo_vmware/tests/test_api.py View File

@@ -14,16 +14,15 @@
# License for the specific language governing permissions and limitations
# 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 unittest import mock

from eventlet import greenthread
import mock
from oslo_context import context
import suds

from oslo_context import context
from oslo_vmware import api
from oslo_vmware import exceptions
from oslo_vmware import pbm


+ 2
- 5
oslo_vmware/tests/test_dvs_util.py View File

@@ -13,13 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.

"""
Unit tests for VMware DVS utility module.
"""
"""Unit tests for VMware DVS utility module."""

import collections

import mock
from unittest import mock

from oslo_vmware import dvs_util
from oslo_vmware.tests import base


+ 2
- 4
oslo_vmware/tests/test_exceptions.py View File

@@ -13,10 +13,8 @@
# License for the specific language governing permissions and limitations
# under the License.

"""
Unit tests for exceptions module.
"""
import mock
"""Unit tests for exceptions module."""
from unittest import mock

from oslo_vmware._i18n import _
from oslo_vmware import exceptions


+ 2
- 5
oslo_vmware/tests/test_image_transfer.py View File

@@ -13,13 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.

"""
Unit tests for functions and classes for image transfer.
"""
"""Unit tests for functions and classes for image transfer."""

import io

import mock
from unittest import mock

from oslo_vmware import exceptions
from oslo_vmware import image_transfer


+ 2
- 4
oslo_vmware/tests/test_pbm.py View File

@@ -13,13 +13,11 @@
# License for the specific language governing permissions and limitations
# under the License.

"""
Unit tests for PBM utility methods.
"""
"""Unit tests for PBM utility methods."""

import os
from unittest import mock

import mock
import urllib.parse as urlparse
import urllib.request as urllib



+ 2
- 4
oslo_vmware/tests/test_rw_handles.py View File

@@ -13,13 +13,11 @@
# License for the specific language governing permissions and limitations
# 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
from unittest import mock

import mock
import requests

from oslo_vmware import exceptions


+ 1
- 1
oslo_vmware/tests/test_service.py View File

@@ -15,9 +15,9 @@

import http.client as httplib
import io
from unittest import mock

import ddt
import mock
import requests
import suds



+ 2
- 4
oslo_vmware/tests/test_vim.py View File

@@ -13,13 +13,11 @@
# License for the specific language governing permissions and limitations
# 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
from unittest import mock

import mock
from oslo_i18n import fixture as i18n_fixture
import suds



+ 2
- 5
oslo_vmware/tests/test_vim_util.py View File

@@ -13,13 +13,10 @@
# License for the specific language governing permissions and limitations
# under the License.

"""
Unit tests for VMware API utility module.
"""
"""Unit tests for VMware API utility module."""

import collections

import mock
from unittest import mock

from oslo_vmware.tests import base
from oslo_vmware import vim_util


+ 0
- 1
test-requirements.txt View File

@@ -6,7 +6,6 @@
hacking>=3.0,<3.1.0 # Apache-2.0

fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
testtools>=2.2.0 # MIT
stestr>=2.0.0 # Apache-2.0



Loading…
Cancel
Save