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: I07d61e1a8f18d65acdf86cdd61f7d9e28157f1d7
Signed-off-by: Sean McGinnis <sean.mcginnis@gmail.com>
changes/25/720925/4
Sean McGinnis 3 years ago
parent 38374adab6
commit edc2ae4249
No known key found for this signature in database
GPG Key ID: CE7EE4BFAF8D70C8

@ -10,7 +10,6 @@ sphinxcontrib-apidoc>=0.2.0 # BSD
# For autodoc builds
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
betamax>=0.7.0 # Apache-2.0
oslo.config>=5.2.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0

@ -13,10 +13,10 @@
"""A fixture to wrap the session constructor for use with Betamax."""
from functools import partial
from unittest import mock
import betamax
import fixtures
import mock
import requests
from keystoneauth1.fixture import hooks

@ -11,10 +11,10 @@
# under the License.
import argparse
from unittest import mock
import uuid
import fixtures
import mock
from keystoneauth1 import loading
from keystoneauth1.loading import cli

@ -10,9 +10,9 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import uuid
import mock
from oslo_config import cfg
from oslo_config import fixture as config
import stevedore

@ -11,9 +11,9 @@
# under the License.
import functools
from unittest import mock
import uuid
import mock
from keystoneauth1 import loading
from keystoneauth1.loading import base

@ -10,9 +10,10 @@
# License for the specific language governing permissions and limitations
# under the License.
from unittest import mock
import betamax
from betamax import exceptions
import mock
import testtools
from keystoneauth1.fixture import keystoneauth_betamax

@ -11,9 +11,9 @@
# under the License.
import json
from unittest import mock
import betamax
import mock
from requests import models
import testtools

@ -12,8 +12,8 @@
import json
import re
from unittest import mock
import mock
from testtools import matchers
from keystoneauth1 import adapter

@ -12,8 +12,8 @@
from threading import Thread
from timeit import default_timer as timer
from unittest import mock
import mock
from six.moves import queue
import testtools

@ -11,8 +11,8 @@
# under the License.
import textwrap
from unittest import mock
import mock
import pycodestyle
import testtools

@ -15,9 +15,9 @@ import itertools
import json
import logging
import sys
from unittest import mock
import uuid
import mock
from oslo_utils import encodeutils
import requests
import requests.auth
@ -978,7 +978,7 @@ class SessionAuthTests(utils.TestCase):
mock_close = mock.Mock()
sess._session.close = mock_close
del sess
mock_close.assert_called_once()
self.assertEqual(1, mock_close.call_count)
def test_service_type_urls(self):
service_type = 'compute'

@ -10,7 +10,6 @@ pycodestyle>=2.0.0,<2.6.0 # MIT
bandit<1.6.0,>=1.1.0 # Apache-2.0
coverage!=4.4,>=4.0 # Apache-2.0
fixtures>=3.0.0 # Apache-2.0/BSD
mock>=2.0.0 # BSD
oslo.config>=5.2.0 # Apache-2.0
oslo.utils>=3.33.0 # Apache-2.0
oslotest>=3.2.0 # Apache-2.0

Loading…
Cancel
Save