summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--cloudinit/config/tests/test_set_passwords.py2
-rw-r--r--cloudinit/net/tests/test_init.py2
-rw-r--r--cloudinit/net/tests/test_network_state.py3
-rw-r--r--cloudinit/sources/tests/test_oracle.py2
-rw-r--r--cloudinit/tests/helpers.py2
-rw-r--r--cloudinit/tests/test_dhclient_hook.py2
-rw-r--r--cloudinit/tests/test_gpg.py4
-rw-r--r--cloudinit/tests/test_version.py4
-rw-r--r--test-requirements.txt1
-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
18 files changed, 22 insertions, 21 deletions
diff --git a/cloudinit/config/tests/test_set_passwords.py b/cloudinit/config/tests/test_set_passwords.py
index 85e2f1fe..3b5cdd06 100644
--- a/cloudinit/config/tests/test_set_passwords.py
+++ b/cloudinit/config/tests/test_set_passwords.py
@@ -1,6 +1,6 @@
# This file is part of cloud-init. See LICENSE file for license information.
-import mock
+from unittest import mock
from cloudinit.config import cc_set_passwords as setpass
from cloudinit.tests.helpers import CiTestCase
diff --git a/cloudinit/net/tests/test_init.py b/cloudinit/net/tests/test_init.py
index 6db93e26..5081a337 100644
--- a/cloudinit/net/tests/test_init.py
+++ b/cloudinit/net/tests/test_init.py
@@ -3,10 +3,10 @@
import copy
import errno
import httpretty
-import mock
import os
import requests
import textwrap
+from unittest import mock
import cloudinit.net as net
from cloudinit.util import ensure_file, write_file, ProcessExecutionError
diff --git a/cloudinit/net/tests/test_network_state.py b/cloudinit/net/tests/test_network_state.py
index fcb4a995..55880852 100644
--- a/cloudinit/net/tests/test_network_state.py
+++ b/cloudinit/net/tests/test_network_state.py
@@ -1,6 +1,7 @@
# This file is part of cloud-init. See LICENSE file for license information.
-import mock
+from unittest import mock
+
from cloudinit.net import network_state
from cloudinit.tests.helpers import CiTestCase
diff --git a/cloudinit/sources/tests/test_oracle.py b/cloudinit/sources/tests/test_oracle.py
index 6c551fcb..abf3d359 100644
--- a/cloudinit/sources/tests/test_oracle.py
+++ b/cloudinit/sources/tests/test_oracle.py
@@ -11,9 +11,9 @@ import argparse
import copy
import httpretty
import json
-import mock
import os
import uuid
+from unittest import mock
DS_PATH = "cloudinit.sources.DataSourceOracle"
MD_VER = "2013-10-17"
diff --git a/cloudinit/tests/helpers.py b/cloudinit/tests/helpers.py
index 0220648d..70f6bad7 100644
--- a/cloudinit/tests/helpers.py
+++ b/cloudinit/tests/helpers.py
@@ -13,8 +13,8 @@ import string
import sys
import tempfile
import time
+from unittest import mock
-import mock
import unittest2
from unittest2.util import strclass
diff --git a/cloudinit/tests/test_dhclient_hook.py b/cloudinit/tests/test_dhclient_hook.py
index 7aab8dd5..eadae81c 100644
--- a/cloudinit/tests/test_dhclient_hook.py
+++ b/cloudinit/tests/test_dhclient_hook.py
@@ -7,8 +7,8 @@ from cloudinit.tests.helpers import CiTestCase, dir2dict, populate_dir
import argparse
import json
-import mock
import os
+from unittest import mock
class TestDhclientHook(CiTestCase):
diff --git a/cloudinit/tests/test_gpg.py b/cloudinit/tests/test_gpg.py
index 0562b966..8dd57137 100644
--- a/cloudinit/tests/test_gpg.py
+++ b/cloudinit/tests/test_gpg.py
@@ -1,12 +1,12 @@
# This file is part of cloud-init. See LICENSE file for license information.
"""Test gpg module."""
+from unittest import mock
+
from cloudinit import gpg
from cloudinit import util
from cloudinit.tests.helpers import CiTestCase
-import mock
-
@mock.patch("cloudinit.gpg.time.sleep")
@mock.patch("cloudinit.gpg.util.subp")
diff --git a/cloudinit/tests/test_version.py b/cloudinit/tests/test_version.py
index a96c2a47..778a762c 100644
--- a/cloudinit/tests/test_version.py
+++ b/cloudinit/tests/test_version.py
@@ -1,10 +1,10 @@
# This file is part of cloud-init. See LICENSE file for license information.
+from unittest import mock
+
from cloudinit.tests.helpers import CiTestCase
from cloudinit import version
-import mock
-
class TestExportsFeatures(CiTestCase):
def test_has_network_config_v1(self):
diff --git a/test-requirements.txt b/test-requirements.txt
index d9d41b57..6fb22b24 100644
--- a/test-requirements.txt
+++ b/test-requirements.txt
@@ -1,6 +1,5 @@
# Needed generally in tests
httpretty>=0.7.1
-mock
nose
unittest2
coverage
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