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:
@@ -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
|
||||
|
@@ -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.
|
||||
|
@@ -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'
|
||||
|
||||
|
@@ -17,7 +17,7 @@ import sys
|
||||
import unittest
|
||||
import urllib
|
||||
|
||||
from mock import (
|
||||
from unittest.mock import (
|
||||
patch,
|
||||
mock_open,
|
||||
MagicMock,
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -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():
|
||||
|
Reference in New Issue
Block a user