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: I4ef04d18b3a6da5cbf3193330957db7846a7bc8d
This commit is contained in:
Hervé Beraud 2020-05-15 18:28:27 +02:00
parent 2c5a72a7d5
commit 404fe100a6
7 changed files with 7 additions and 15 deletions

View File

@ -2,7 +2,6 @@
# The order of packages is significant, because pip processes them in the order # The order of packages is significant, because pip processes them in the order
# of appearance. Changing the order has an impact on the overall integration # of appearance. Changing the order has an impact on the overall integration
# process, which may cause wedges in the gate later. # process, which may cause wedges in the gate later.
mock>=2.0 # BSD
python-subunit>=0.0.18 # Apache-2.0/BSD python-subunit>=0.0.18 # Apache-2.0/BSD
testtools>=1.4.0 # MIT testtools>=1.4.0 # MIT
coverage>=3.6 # Apache-2.0 coverage>=3.6 # Apache-2.0

View File

@ -16,9 +16,9 @@
# under the License. # under the License.
import os import os
from unittest import mock
import fixtures import fixtures
import mock
from testtools import testcase from testtools import testcase
import tooz import tooz

View File

@ -16,9 +16,9 @@
import threading import threading
import time import time
from unittest import mock
from concurrent import futures from concurrent import futures
import mock
from six.moves.urllib import parse from six.moves.urllib import parse
from testtools import matchers from testtools import matchers
from testtools import testcase from testtools import testcase

View File

@ -14,7 +14,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 testtools import testcase from testtools import testcase
import tooz.coordination import tooz.coordination

View File

@ -14,8 +14,8 @@
# under the License. # under the License.
import hashlib import hashlib
from unittest import mock
import mock
from testtools import matchers from testtools import matchers
from testtools import testcase from testtools import testcase

View File

@ -16,11 +16,7 @@
# under the License. # under the License.
import socket import socket
from unittest import mock
try:
from unittest import mock
except ImportError:
import mock
from testtools import testcase from testtools import testcase

View File

@ -14,11 +14,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.
try: from unittest import mock
# Added in python 3.3+
from unittest import mock
except ImportError:
import mock
from oslo_utils import encodeutils from oslo_utils import encodeutils
import testtools import testtools