Use unittest.mock instead of mock

The mock third party library was needed for mock support in py2
runtimes. Since we now only support py36 and later, we can use the
standard lib unittest.mock module instead.

Change-Id: Id4029239c345655ea7ffc90b5969b29b47a84955
This commit is contained in:
Hervé Beraud
2020-06-09 00:02:15 +02:00
parent 208adcd2d6
commit 3dd824c5b9
10 changed files with 10 additions and 11 deletions

View File

@@ -9,7 +9,6 @@
#
charm-tools>=2.4.4
requests>=2.18.4
mock>=1.2
flake8>=2.2.4,<=2.4.1
stestr>=2.2.0
coverage>=4.5.2

View File

@@ -18,12 +18,12 @@ import sys
import tempfile
import unittest
import mock
from unittest import mock
import yaml
from unit_tests.test_utils import CharmTestCase
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
# python-apt is not installed as part of test-requirements but is imported by
# some charmhelpers modules so create a fake import.

View File

@@ -15,7 +15,7 @@
import os
import sys
from mock import patch, MagicMock
from unittest.mock import patch, MagicMock
os.environ['JUJU_UNIT_NAME'] = 'swift-storage'

View File

@@ -17,7 +17,7 @@ import sys
import unittest
import urllib
from mock import (
from unittest.mock import (
patch,
mock_open,
MagicMock,

View File

@@ -17,7 +17,7 @@ import tempfile
import unittest
import shutil
from mock import patch
from unittest.mock import patch
from lib.misc_utils import ensure_block_device

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import MagicMock
from unittest.mock import MagicMock
from unit_tests.test_utils import CharmTestCase, patch_open

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
from mock import patch
from unittest.mock import patch
import json
import os
import tempfile

View File

@@ -13,7 +13,7 @@
# limitations under the License.
from collections import namedtuple
from mock import call, patch, MagicMock
from unittest.mock import call, patch, MagicMock
import shutil
import tempfile

View File

@@ -12,7 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import mock
from unittest import mock
import unittest
from jinja2 import Environment

View File

@@ -19,7 +19,7 @@ import unittest
import yaml
from contextlib import contextmanager
from mock import MagicMock, patch
from unittest.mock import MagicMock, patch
def load_config():