summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDaniel Watkins <oddbloke@ubuntu.com>2020-01-29 16:55:39 -0500
committerGitHub <noreply@github.com>2020-01-29 14:55:39 -0700
commit5f8f85bb38cc972d3d2c705a1ec73db3f690f323 (patch)
tree6f024357106ab9cd33334096dadd9978b3561849 /tests
parent8409dd7da21b064214091edd8f1469267be1e738 (diff)
downloadvyos-cloud-init-5f8f85bb38cc972d3d2c705a1ec73db3f690f323.tar.gz
vyos-cloud-init-5f8f85bb38cc972d3d2c705a1ec73db3f690f323.zip
Replace mock library with unittest.mock (#186)
* cloudinit: replace "import mock" with "from unittest import mock" * test-requirements.txt: drop mock Co-authored-by: Chad Smith <chad.smith@canonical.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/unittests/test_datasource/test_aliyun.py2
-rw-r--r--tests/unittests/test_datasource/test_ec2.py2
-rw-r--r--tests/unittests/test_datasource/test_gce.py2
-rw-r--r--tests/unittests/test_datasource/test_maas.py2
-rw-r--r--tests/unittests/test_distros/test_user_data_normalize.py3
-rw-r--r--tests/unittests/test_handler/test_handler_locale.py2
-rw-r--r--tests/unittests/test_reporting.py4
-rw-r--r--tests/unittests/test_reporting_hyperv.py2
-rw-r--r--tests/unittests/test_sshutil.py2
9 files changed, 11 insertions, 10 deletions
diff --git a/tests/unittests/test_datasource/test_aliyun.py b/tests/unittests/test_datasource/test_aliyun.py
index e9213ca1..1e66fcdb 100644
--- a/tests/unittests/test_datasource/test_aliyun.py
+++ b/tests/unittests/test_datasource/test_aliyun.py
@@ -2,8 +2,8 @@
import functools
import httpretty
-import mock
import os
+from unittest import mock
from cloudinit import helpers
from cloudinit.sources import DataSourceAliYun as ay
diff --git a/tests/unittests/test_datasource/test_ec2.py b/tests/unittests/test_datasource/test_ec2.py
index 34a089f2..19e1af2b 100644
--- a/tests/unittests/test_datasource/test_ec2.py
+++ b/tests/unittests/test_datasource/test_ec2.py
@@ -3,7 +3,7 @@
import copy
import httpretty
import json
-import mock
+from unittest import mock
from cloudinit import helpers
from cloudinit.sources import DataSourceEc2 as ec2
diff --git a/tests/unittests/test_datasource/test_gce.py b/tests/unittests/test_datasource/test_gce.py
index 67744d32..e9dd6e60 100644
--- a/tests/unittests/test_datasource/test_gce.py
+++ b/tests/unittests/test_datasource/test_gce.py
@@ -7,8 +7,8 @@
import datetime
import httpretty
import json
-import mock
import re
+from unittest import mock
from base64 import b64encode, b64decode
from six.moves.urllib_parse import urlparse
diff --git a/tests/unittests/test_datasource/test_maas.py b/tests/unittests/test_datasource/test_maas.py
index c84d067e..2a81d3f5 100644
--- a/tests/unittests/test_datasource/test_maas.py
+++ b/tests/unittests/test_datasource/test_maas.py
@@ -1,11 +1,11 @@
# This file is part of cloud-init. See LICENSE file for license information.
from copy import copy
-import mock
import os
import shutil
import tempfile
import yaml
+from unittest import mock
from cloudinit.sources import DataSourceMAAS
from cloudinit import url_helper
diff --git a/tests/unittests/test_distros/test_user_data_normalize.py b/tests/unittests/test_distros/test_user_data_normalize.py
index fa4b6cfe..a6faf0ef 100644
--- a/tests/unittests/test_distros/test_user_data_normalize.py
+++ b/tests/unittests/test_distros/test_user_data_normalize.py
@@ -1,12 +1,13 @@
# This file is part of cloud-init. See LICENSE file for license information.
+from unittest import mock
+
from cloudinit import distros
from cloudinit.distros import ug_util
from cloudinit import helpers
from cloudinit import settings
from cloudinit.tests.helpers import TestCase
-import mock
bcfg = {
diff --git a/tests/unittests/test_handler/test_handler_locale.py b/tests/unittests/test_handler/test_handler_locale.py
index e29a06f9..b3deb250 100644
--- a/tests/unittests/test_handler/test_handler_locale.py
+++ b/tests/unittests/test_handler/test_handler_locale.py
@@ -20,10 +20,10 @@ from configobj import ConfigObj
from six import BytesIO
import logging
-import mock
import os
import shutil
import tempfile
+from unittest import mock
LOG = logging.getLogger(__name__)
diff --git a/tests/unittests/test_reporting.py b/tests/unittests/test_reporting.py
index e15ba6cf..6814030e 100644
--- a/tests/unittests/test_reporting.py
+++ b/tests/unittests/test_reporting.py
@@ -2,12 +2,12 @@
#
# This file is part of cloud-init. See LICENSE file for license information.
+from unittest import mock
+
from cloudinit import reporting
from cloudinit.reporting import events
from cloudinit.reporting import handlers
-import mock
-
from cloudinit.tests.helpers import TestCase
diff --git a/tests/unittests/test_reporting_hyperv.py b/tests/unittests/test_reporting_hyperv.py
index 3582cf0b..b3e083c6 100644
--- a/tests/unittests/test_reporting_hyperv.py
+++ b/tests/unittests/test_reporting_hyperv.py
@@ -8,7 +8,7 @@ import os
import struct
import time
import re
-import mock
+from unittest import mock
from cloudinit import util
from cloudinit.tests.helpers import CiTestCase
diff --git a/tests/unittests/test_sshutil.py b/tests/unittests/test_sshutil.py
index b227c20b..0be41924 100644
--- a/tests/unittests/test_sshutil.py
+++ b/tests/unittests/test_sshutil.py
@@ -1,7 +1,7 @@
# This file is part of cloud-init. See LICENSE file for license information.
-from mock import patch
from collections import namedtuple
+from unittest.mock import patch
from cloudinit import ssh_util
from cloudinit.tests import helpers as test_helpers