diff --git a/horizon/test/unit/hacking/test_checks.py b/horizon/test/unit/hacking/test_checks.py index 54484a05b9..6d4c9b3a06 100644 --- a/horizon/test/unit/hacking/test_checks.py +++ b/horizon/test/unit/hacking/test_checks.py @@ -11,10 +11,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. - import textwrap +from unittest import mock + -import mock import pycodestyle from horizon.hacking import checks diff --git a/horizon/test/unit/management/commands/test_startdash.py b/horizon/test/unit/management/commands/test_startdash.py index fc67d8d174..ead4265e61 100644 --- a/horizon/test/unit/management/commands/test_startdash.py +++ b/horizon/test/unit/management/commands/test_startdash.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from django.core.management import call_command from django.core.management import CommandError diff --git a/horizon/test/unit/management/commands/test_startpanel.py b/horizon/test/unit/management/commands/test_startpanel.py index 27d8999f3f..17769ce004 100644 --- a/horizon/test/unit/management/commands/test_startpanel.py +++ b/horizon/test/unit/management/commands/test_startpanel.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from django.core.management import call_command from django.core.management import CommandError diff --git a/horizon/test/unit/middleware/test_base.py b/horizon/test/unit/middleware/test_base.py index 01f75ec82b..8528f681de 100644 --- a/horizon/test/unit/middleware/test_base.py +++ b/horizon/test/unit/middleware/test_base.py @@ -14,8 +14,8 @@ # under the License. import datetime +from unittest import mock -import mock import pytz from django.conf import settings diff --git a/horizon/test/unit/middleware/test_operation_log.py b/horizon/test/unit/middleware/test_operation_log.py index 673ce63cd1..117a2dcc94 100644 --- a/horizon/test/unit/middleware/test_operation_log.py +++ b/horizon/test/unit/middleware/test_operation_log.py @@ -13,8 +13,8 @@ # License for the specific language governing permissions and limitations # under the License. -import mock -from mock import patch +from unittest import mock +from unittest.mock import patch from django.conf import settings from django.core.exceptions import MiddlewareNotUsed diff --git a/horizon/test/unit/tables/test_tables.py b/horizon/test/unit/tables/test_tables.py index 1bc03501a7..d34c9af19e 100644 --- a/horizon/test/unit/tables/test_tables.py +++ b/horizon/test/unit/tables/test_tables.py @@ -16,6 +16,7 @@ # under the License. import unittest +from unittest import mock import uuid from django import forms @@ -25,7 +26,6 @@ from django.template import defaultfilters from django.test.utils import override_settings from django.urls import reverse from django.utils.translation import ungettext_lazy -import mock from horizon import exceptions from horizon import tables diff --git a/horizon/test/unit/workflows/test_workflows.py b/horizon/test/unit/workflows/test_workflows.py index 7df55c2089..f4e455176b 100644 --- a/horizon/test/unit/workflows/test_workflows.py +++ b/horizon/test/unit/workflows/test_workflows.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from django import forms from django import http diff --git a/lower-constraints.txt b/lower-constraints.txt index 95c1b98b59..d49f82cef8 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -47,7 +47,6 @@ kombu==4.0.0 linecache2==1.0.0 MarkupSafe==1.0 mccabe==0.2.1 -mock==2.0.0 monotonic==0.6 msgpack-python==0.4.0 munch==2.1.0 diff --git a/openstack_auth/tests/unit/test_auth.py b/openstack_auth/tests/unit/test_auth.py index 42d3a61373..6b52ed1e55 100644 --- a/openstack_auth/tests/unit/test_auth.py +++ b/openstack_auth/tests/unit/test_auth.py @@ -11,6 +11,7 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock import uuid from django.conf import settings @@ -23,7 +24,7 @@ from keystoneauth1.identity import v3 as v3_auth from keystoneauth1 import session from keystoneclient.v3 import client as client_v3 from keystoneclient.v3 import projects -import mock + from openstack_auth.plugin import password from openstack_auth.tests import data_v3 diff --git a/openstack_auth/tests/unit/test_policy.py b/openstack_auth/tests/unit/test_policy.py index 45a15ede75..fe8541cb00 100644 --- a/openstack_auth/tests/unit/test_policy.py +++ b/openstack_auth/tests/unit/test_policy.py @@ -11,9 +11,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + from django import http from django import test -import mock from openstack_auth import policy from openstack_auth import user diff --git a/openstack_auth/tests/unit/test_user.py b/openstack_auth/tests/unit/test_user.py index 9ad14ea5ac..0e8bd1758d 100644 --- a/openstack_auth/tests/unit/test_user.py +++ b/openstack_auth/tests/unit/test_user.py @@ -11,8 +11,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + from django import test -import mock from openstack_auth import user diff --git a/openstack_dashboard/dashboards/admin/aggregates/tests.py b/openstack_dashboard/dashboards/admin/aggregates/tests.py index 96881f7a9c..3ed03ba57b 100644 --- a/openstack_dashboard/dashboards/admin/aggregates/tests.py +++ b/openstack_dashboard/dashboards/admin/aggregates/tests.py @@ -10,7 +10,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from django.urls import reverse from django.utils import html diff --git a/openstack_dashboard/dashboards/admin/defaults/tests.py b/openstack_dashboard/dashboards/admin/defaults/tests.py index 83ebbc3b31..259f8106f9 100644 --- a/openstack_dashboard/dashboards/admin/defaults/tests.py +++ b/openstack_dashboard/dashboards/admin/defaults/tests.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/flavors/tests.py b/openstack_dashboard/dashboards/admin/flavors/tests.py index 47e7bbbe05..07ddef47bf 100644 --- a/openstack_dashboard/dashboards/admin/flavors/tests.py +++ b/openstack_dashboard/dashboards/admin/flavors/tests.py @@ -10,10 +10,11 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import django from django.conf import settings from django.urls import reverse -import mock from novaclient.v2 import flavors from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/admin/hypervisors/tests.py b/openstack_dashboard/dashboards/admin/hypervisors/tests.py index 5d21a90427..be8af4a51b 100644 --- a/openstack_dashboard/dashboards/admin/hypervisors/tests.py +++ b/openstack_dashboard/dashboards/admin/hypervisors/tests.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/images/tests.py b/openstack_dashboard/dashboards/admin/images/tests.py index a75ba4d726..5d5fe2a125 100644 --- a/openstack_dashboard/dashboards/admin/images/tests.py +++ b/openstack_dashboard/dashboards/admin/images/tests.py @@ -12,12 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.conf import settings from django.test.utils import override_settings from django.urls import reverse -import mock - from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/info/tests.py b/openstack_dashboard/dashboards/admin/info/tests.py index fa46da2712..fed5d001c3 100644 --- a/openstack_dashboard/dashboards/admin/info/tests.py +++ b/openstack_dashboard/dashboards/admin/info/tests.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from django.urls import reverse diff --git a/openstack_dashboard/dashboards/admin/instances/tests.py b/openstack_dashboard/dashboards/admin/instances/tests.py index 4f331093e4..57b8582658 100644 --- a/openstack_dashboard/dashboards/admin/instances/tests.py +++ b/openstack_dashboard/dashboards/admin/instances/tests.py @@ -13,11 +13,9 @@ # under the License. from collections import OrderedDict - +from unittest import mock import uuid -import mock - from django.conf import settings from django.test import override_settings from django.urls import reverse diff --git a/openstack_dashboard/dashboards/admin/metadata_defs/tests.py b/openstack_dashboard/dashboards/admin/metadata_defs/tests.py index 31b216b676..bcc1ac3971 100644 --- a/openstack_dashboard/dashboards/admin/metadata_defs/tests.py +++ b/openstack_dashboard/dashboards/admin/metadata_defs/tests.py @@ -15,11 +15,10 @@ import json +from unittest import mock from django.urls import reverse -import mock - from openstack_dashboard import api from openstack_dashboard.dashboards.admin.metadata_defs \ import constants diff --git a/openstack_dashboard/dashboards/admin/networks/agents/tests.py b/openstack_dashboard/dashboards/admin/networks/agents/tests.py index 78d19396ad..74100abff3 100644 --- a/openstack_dashboard/dashboards/admin/networks/agents/tests.py +++ b/openstack_dashboard/dashboards/admin/networks/agents/tests.py @@ -13,9 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/networks/ports/tests.py b/openstack_dashboard/dashboards/admin/networks/ports/tests.py index 57676f18f9..7ff7cc9428 100644 --- a/openstack_dashboard/dashboards/admin/networks/ports/tests.py +++ b/openstack_dashboard/dashboards/admin/networks/ports/tests.py @@ -14,12 +14,11 @@ # under the License. import collections +from unittest import mock from django.test.utils import override_settings from django.urls import reverse -import mock - from horizon.workflows import views from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/admin/networks/subnets/tests.py b/openstack_dashboard/dashboards/admin/networks/subnets/tests.py index b95d42febb..1550543562 100644 --- a/openstack_dashboard/dashboards/admin/networks/subnets/tests.py +++ b/openstack_dashboard/dashboards/admin/networks/subnets/tests.py @@ -14,9 +14,9 @@ # under the License. import collections +from unittest import mock from django.urls import reverse -import mock from horizon.workflows import views diff --git a/openstack_dashboard/dashboards/admin/networks/tests.py b/openstack_dashboard/dashboards/admin/networks/tests.py index b6f919d876..de9be31cdf 100644 --- a/openstack_dashboard/dashboards/admin/networks/tests.py +++ b/openstack_dashboard/dashboards/admin/networks/tests.py @@ -13,12 +13,11 @@ # under the License. import collections +from unittest import mock from django.urls import reverse from django.utils.http import urlunquote -import mock - from horizon import forms from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/admin/overview/tests.py b/openstack_dashboard/dashboards/admin/overview/tests.py index e665f3ffad..a8dda841c9 100644 --- a/openstack_dashboard/dashboards/admin/overview/tests.py +++ b/openstack_dashboard/dashboards/admin/overview/tests.py @@ -17,14 +17,13 @@ # under the License. import datetime +from unittest import mock from django.test.utils import override_settings from django.urls import reverse from django.utils import encoding from django.utils import timezone -import mock - from horizon.templatetags import sizeformat from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/admin/rbac_policies/tests.py b/openstack_dashboard/dashboards/admin/rbac_policies/tests.py index 8858b7ac87..226e91b071 100644 --- a/openstack_dashboard/dashboards/admin/rbac_policies/tests.py +++ b/openstack_dashboard/dashboards/admin/rbac_policies/tests.py @@ -11,8 +11,10 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + +from unittest import mock + from django.urls import reverse -import mock from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/routers/tests.py b/openstack_dashboard/dashboards/admin/routers/tests.py index 28c8dd2738..f9718bc060 100644 --- a/openstack_dashboard/dashboards/admin/routers/tests.py +++ b/openstack_dashboard/dashboards/admin/routers/tests.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.dashboards.project.routers import tests as r_test diff --git a/openstack_dashboard/dashboards/admin/snapshots/tests.py b/openstack_dashboard/dashboards/admin/snapshots/tests.py index 3403ac7218..c1f7b8cf78 100644 --- a/openstack_dashboard/dashboards/admin/snapshots/tests.py +++ b/openstack_dashboard/dashboards/admin/snapshots/tests.py @@ -10,11 +10,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.conf import settings from django.test.utils import override_settings from django.urls import reverse from django.utils.http import urlunquote -import mock from openstack_dashboard.api import cinder from openstack_dashboard.api import keystone diff --git a/openstack_dashboard/dashboards/admin/vg_snapshots/tests.py b/openstack_dashboard/dashboards/admin/vg_snapshots/tests.py index 0e3614de7a..5e4df7b72d 100644 --- a/openstack_dashboard/dashboards/admin/vg_snapshots/tests.py +++ b/openstack_dashboard/dashboards/admin/vg_snapshots/tests.py @@ -12,8 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.urls import reverse -import mock from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/admin/volume_groups/tests.py b/openstack_dashboard/dashboards/admin/volume_groups/tests.py index 579ea9b86f..8a0ea243d3 100644 --- a/openstack_dashboard/dashboards/admin/volume_groups/tests.py +++ b/openstack_dashboard/dashboards/admin/volume_groups/tests.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tests.py b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tests.py index ee4af64a6c..4bc2ed7173 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tests.py +++ b/openstack_dashboard/dashboards/admin/volume_types/qos_specs/tests.py @@ -10,9 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.dashboards.admin.volume_types.qos_specs \ diff --git a/openstack_dashboard/dashboards/admin/volume_types/tests.py b/openstack_dashboard/dashboards/admin/volume_types/tests.py index e2a44c5626..fb6a734e2f 100644 --- a/openstack_dashboard/dashboards/admin/volume_types/tests.py +++ b/openstack_dashboard/dashboards/admin/volume_types/tests.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.urls import reverse -import mock from horizon import exceptions diff --git a/openstack_dashboard/dashboards/identity/application_credentials/tests.py b/openstack_dashboard/dashboards/identity/application_credentials/tests.py index f5e0d5b589..496e6a2e9a 100644 --- a/openstack_dashboard/dashboards/identity/application_credentials/tests.py +++ b/openstack_dashboard/dashboards/identity/application_credentials/tests.py @@ -12,7 +12,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from django.urls import reverse diff --git a/openstack_dashboard/dashboards/identity/domains/tests.py b/openstack_dashboard/dashboards/identity/domains/tests.py index 754d669a47..af9ae709f3 100644 --- a/openstack_dashboard/dashboards/identity/domains/tests.py +++ b/openstack_dashboard/dashboards/identity/domains/tests.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from horizon.workflows import views diff --git a/openstack_dashboard/dashboards/identity/groups/tests.py b/openstack_dashboard/dashboards/identity/groups/tests.py index 28ec1d20cb..7ebf957941 100644 --- a/openstack_dashboard/dashboards/identity/groups/tests.py +++ b/openstack_dashboard/dashboards/identity/groups/tests.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/identity/projects/tests.py b/openstack_dashboard/dashboards/identity/projects/tests.py index 93ceac3594..e284d82b59 100644 --- a/openstack_dashboard/dashboards/identity/projects/tests.py +++ b/openstack_dashboard/dashboards/identity/projects/tests.py @@ -14,14 +14,13 @@ import datetime import logging +from unittest import mock from django.test import tag from django.test.utils import override_settings from django.urls import reverse from django.utils import timezone -import mock - from horizon.workflows import views from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/identity/roles/tests.py b/openstack_dashboard/dashboards/identity/roles/tests.py index 16ed5356c0..b24ec3985f 100644 --- a/openstack_dashboard/dashboards/identity/roles/tests.py +++ b/openstack_dashboard/dashboards/identity/roles/tests.py @@ -12,9 +12,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/identity/users/tests.py b/openstack_dashboard/dashboards/identity/users/tests.py index 68fc2affe8..2c1edd7174 100644 --- a/openstack_dashboard/dashboards/identity/users/tests.py +++ b/openstack_dashboard/dashboards/identity/users/tests.py @@ -17,12 +17,11 @@ # under the License. from socket import timeout as socket_timeout +from unittest import mock from django.test.utils import override_settings from django.urls import reverse -import mock - from openstack_dashboard import api from openstack_dashboard.dashboards.identity.users import tabs from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/floating_ips/tests.py b/openstack_dashboard/dashboards/project/floating_ips/tests.py index 4664d11a18..d900b5c13b 100644 --- a/openstack_dashboard/dashboards/project/floating_ips/tests.py +++ b/openstack_dashboard/dashboards/project/floating_ips/tests.py @@ -17,11 +17,11 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.urls import reverse from django.utils.http import urlencode -import mock - from openstack_dashboard import api from openstack_dashboard.test import helpers as test from openstack_dashboard.usage import quotas diff --git a/openstack_dashboard/dashboards/project/images/images/tests.py b/openstack_dashboard/dashboards/project/images/images/tests.py index b450c596f3..9cf1fa3711 100644 --- a/openstack_dashboard/dashboards/project/images/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/images/tests.py @@ -17,14 +17,13 @@ # under the License. import tempfile +from unittest import mock from django.conf import settings from django.core.files.uploadedfile import InMemoryUploadedFile from django.test.utils import override_settings from django.urls import reverse -import mock - from horizon import tables as horizon_tables from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/images/snapshots/tests.py b/openstack_dashboard/dashboards/project/images/snapshots/tests.py index 4e598d3ce2..48d5d8fec0 100644 --- a/openstack_dashboard/dashboards/project/images/snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/images/snapshots/tests.py @@ -16,9 +16,9 @@ # License for the specific language governing permissions and limitations # under the License. -from django.urls import reverse +from unittest import mock -import mock +from django.urls import reverse from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/images/tests.py b/openstack_dashboard/dashboards/project/images/tests.py index 07413808fa..5599ae0e61 100644 --- a/openstack_dashboard/dashboards/project/images/tests.py +++ b/openstack_dashboard/dashboards/project/images/tests.py @@ -21,11 +21,10 @@ import os from socket import timeout as socket_timeout import tempfile import unittest +from unittest import mock from django.urls import reverse -import mock - from horizon import exceptions from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/project/instances/tests.py b/openstack_dashboard/dashboards/project/instances/tests.py index 7b9df1fbb1..b7ef8cac80 100644 --- a/openstack_dashboard/dashboards/project/instances/tests.py +++ b/openstack_dashboard/dashboards/project/instances/tests.py @@ -20,6 +20,7 @@ import collections import json import logging import sys +from unittest import mock from django.conf import settings from django.forms import widgets @@ -28,7 +29,6 @@ import django.test from django.test.utils import override_settings from django.urls import reverse from django.utils.http import urlencode -import mock from novaclient import api_versions from horizon import exceptions diff --git a/openstack_dashboard/dashboards/project/key_pairs/tests.py b/openstack_dashboard/dashboards/project/key_pairs/tests.py index 0f5ce7391a..cbfdc5004e 100644 --- a/openstack_dashboard/dashboards/project/key_pairs/tests.py +++ b/openstack_dashboard/dashboards/project/key_pairs/tests.py @@ -16,10 +16,10 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock from urllib import parse from django.urls import reverse -import mock from openstack_dashboard import api from openstack_dashboard.dashboards.project.key_pairs.forms \ diff --git a/openstack_dashboard/dashboards/project/network_topology/tests.py b/openstack_dashboard/dashboards/project/network_topology/tests.py index 5d5c50cac5..ac7330ca19 100644 --- a/openstack_dashboard/dashboards/project/network_topology/tests.py +++ b/openstack_dashboard/dashboards/project/network_topology/tests.py @@ -12,10 +12,11 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + import django.test from django.urls import reverse -import mock from oslo_serialization import jsonutils from openstack_dashboard import api diff --git a/openstack_dashboard/dashboards/project/networks/ports/tests.py b/openstack_dashboard/dashboards/project/networks/ports/tests.py index 4bcb077795..61bc3f4841 100644 --- a/openstack_dashboard/dashboards/project/networks/ports/tests.py +++ b/openstack_dashboard/dashboards/project/networks/ports/tests.py @@ -15,12 +15,11 @@ import collections import copy +from unittest import mock from django.test.utils import override_settings from django.urls import reverse -import mock - from openstack_auth import utils as auth_utils from horizon.workflows import views diff --git a/openstack_dashboard/dashboards/project/networks/subnets/tests.py b/openstack_dashboard/dashboards/project/networks/subnets/tests.py index 598a3c091c..d8f6f25af5 100644 --- a/openstack_dashboard/dashboards/project/networks/subnets/tests.py +++ b/openstack_dashboard/dashboards/project/networks/subnets/tests.py @@ -13,8 +13,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.urls import reverse -import mock from horizon.workflows import views diff --git a/openstack_dashboard/dashboards/project/networks/tests.py b/openstack_dashboard/dashboards/project/networks/tests.py index 69db99346f..227611792d 100644 --- a/openstack_dashboard/dashboards/project/networks/tests.py +++ b/openstack_dashboard/dashboards/project/networks/tests.py @@ -13,11 +13,11 @@ # under the License. import collections +from unittest import mock from django.urls import reverse from django.utils.html import escape from django.utils.http import urlunquote -import mock from horizon.workflows import views diff --git a/openstack_dashboard/dashboards/project/overview/tests.py b/openstack_dashboard/dashboards/project/overview/tests.py index adfad843b6..38bf36c8e6 100644 --- a/openstack_dashboard/dashboards/project/overview/tests.py +++ b/openstack_dashboard/dashboards/project/overview/tests.py @@ -18,13 +18,12 @@ import datetime import logging +from unittest import mock from django.test.utils import override_settings from django.urls import reverse from django.utils import timezone -import mock - from openstack_dashboard import api from openstack_dashboard.test import helpers as test from openstack_dashboard import usage diff --git a/openstack_dashboard/dashboards/project/routers/tests.py b/openstack_dashboard/dashboards/project/routers/tests.py index 08374fa544..4a8b90c395 100644 --- a/openstack_dashboard/dashboards/project/routers/tests.py +++ b/openstack_dashboard/dashboards/project/routers/tests.py @@ -11,12 +11,12 @@ # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. + import copy +from unittest import mock from django.urls import reverse -import mock - from openstack_dashboard import api from openstack_dashboard.test import helpers as test from openstack_dashboard.usage import quotas diff --git a/openstack_dashboard/dashboards/project/security_groups/tests.py b/openstack_dashboard/dashboards/project/security_groups/tests.py index 4351ff2901..6290fc229d 100644 --- a/openstack_dashboard/dashboards/project/security_groups/tests.py +++ b/openstack_dashboard/dashboards/project/security_groups/tests.py @@ -16,7 +16,7 @@ # License for the specific language governing permissions and limitations # under the License. -import mock +from unittest import mock from django.conf import settings from django.urls import reverse diff --git a/openstack_dashboard/dashboards/project/snapshots/tests.py b/openstack_dashboard/dashboards/project/snapshots/tests.py index 7a8b5dd4a5..d2efc9f13b 100644 --- a/openstack_dashboard/dashboards/project/snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/snapshots/tests.py @@ -16,11 +16,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.conf import settings from django.test.utils import override_settings from django.urls import reverse from django.utils.http import urlunquote -import mock from openstack_dashboard import api from openstack_dashboard.dashboards.project.snapshots \ diff --git a/openstack_dashboard/dashboards/project/vg_snapshots/tests.py b/openstack_dashboard/dashboards/project/vg_snapshots/tests.py index a749de7151..d66185335c 100644 --- a/openstack_dashboard/dashboards/project/vg_snapshots/tests.py +++ b/openstack_dashboard/dashboards/project/vg_snapshots/tests.py @@ -10,8 +10,9 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.urls import reverse -import mock from openstack_dashboard.api import cinder from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/volume_groups/tests.py b/openstack_dashboard/dashboards/project/volume_groups/tests.py index 3d799794fc..e5caffd291 100644 --- a/openstack_dashboard/dashboards/project/volume_groups/tests.py +++ b/openstack_dashboard/dashboards/project/volume_groups/tests.py @@ -10,9 +10,10 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.urls import reverse from django.utils.http import urlunquote -import mock from openstack_dashboard.api import cinder from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/dashboards/project/volumes/tests.py b/openstack_dashboard/dashboards/project/volumes/tests.py index 0c3c3c4535..6d3e158a45 100644 --- a/openstack_dashboard/dashboards/project/volumes/tests.py +++ b/openstack_dashboard/dashboards/project/volumes/tests.py @@ -13,8 +13,7 @@ # under the License. import copy - -import mock +from unittest import mock from django.conf import settings from django.forms import widgets diff --git a/openstack_dashboard/dashboards/settings/password/tests.py b/openstack_dashboard/dashboards/settings/password/tests.py index 78b2358119..9d1d9e4591 100644 --- a/openstack_dashboard/dashboards/settings/password/tests.py +++ b/openstack_dashboard/dashboards/settings/password/tests.py @@ -12,13 +12,13 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock from urllib.parse import urlsplit from django.conf import settings from django import http from django.urls import reverse -import mock from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/test/helpers.py b/openstack_dashboard/test/helpers.py index cc55d45303..1d0e3511e8 100644 --- a/openstack_dashboard/test/helpers.py +++ b/openstack_dashboard/test/helpers.py @@ -21,6 +21,7 @@ import importlib import logging import os import traceback +from unittest import mock from django.conf import settings from django.contrib.messages.storage import default_storage @@ -30,7 +31,6 @@ from django.test import tag from django import urls from django.utils import http -import mock from openstack_auth import user from openstack_auth import utils from requests.packages.urllib3.connection import HTTPConnection diff --git a/openstack_dashboard/test/unit/api/rest/test_config.py b/openstack_dashboard/test/unit/api/rest/test_config.py index 7ce7c9a042..c20054db5d 100644 --- a/openstack_dashboard/test/unit/api/rest/test_config.py +++ b/openstack_dashboard/test/unit/api/rest/test_config.py @@ -12,7 +12,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/test/unit/api/rest/test_glance.py b/openstack_dashboard/test/unit/api/rest/test_glance.py index 9bfe213978..ab51622892 100644 --- a/openstack_dashboard/test/unit/api/rest/test_glance.py +++ b/openstack_dashboard/test/unit/api/rest/test_glance.py @@ -12,7 +12,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from openstack_dashboard import api from openstack_dashboard.api.rest import glance diff --git a/openstack_dashboard/test/unit/api/rest/test_keystone.py b/openstack_dashboard/test/unit/api/rest/test_keystone.py index a462db4948..aac2ca8d60 100644 --- a/openstack_dashboard/test/unit/api/rest/test_keystone.py +++ b/openstack_dashboard/test/unit/api/rest/test_keystone.py @@ -12,8 +12,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + from django.conf import settings -import mock from oslo_serialization import jsonutils from openstack_dashboard import api diff --git a/openstack_dashboard/test/unit/api/rest/test_neutron.py b/openstack_dashboard/test/unit/api/rest/test_neutron.py index 09e37208ec..5c56eb7f25 100644 --- a/openstack_dashboard/test/unit/api/rest/test_neutron.py +++ b/openstack_dashboard/test/unit/api/rest/test_neutron.py @@ -13,8 +13,9 @@ # See the License for the specific language governing permissions and # limitations under the License. +from unittest import mock + from django.http import request as django_request -import mock from openstack_dashboard import api from openstack_dashboard.api import base diff --git a/openstack_dashboard/test/unit/api/rest/test_nova.py b/openstack_dashboard/test/unit/api/rest/test_nova.py index 148880866a..63156d040a 100644 --- a/openstack_dashboard/test/unit/api/rest/test_nova.py +++ b/openstack_dashboard/test/unit/api/rest/test_nova.py @@ -14,10 +14,10 @@ import json from json import loads as to_json +from unittest import mock import uuid from django.conf import settings -import mock from openstack_dashboard import api from openstack_dashboard.api.base import Quota diff --git a/openstack_dashboard/test/unit/api/rest/test_swift.py b/openstack_dashboard/test/unit/api/rest/test_swift.py index 0d7512bf30..f6ac16f8e0 100644 --- a/openstack_dashboard/test/unit/api/rest/test_swift.py +++ b/openstack_dashboard/test/unit/api/rest/test_swift.py @@ -11,7 +11,7 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. -import mock +from unittest import mock from openstack_dashboard import api from openstack_dashboard.api.rest import swift diff --git a/openstack_dashboard/test/unit/api/test_cinder.py b/openstack_dashboard/test/unit/api/test_cinder.py index c25fd56142..769f29bed6 100644 --- a/openstack_dashboard/test/unit/api/test_cinder.py +++ b/openstack_dashboard/test/unit/api/test_cinder.py @@ -12,11 +12,12 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.conf import settings from django.test.utils import override_settings import cinderclient as cinder_client -import mock from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/test/unit/api/test_glance.py b/openstack_dashboard/test/unit/api/test_glance.py index 0aac18a1d2..3a364797d6 100644 --- a/openstack_dashboard/test/unit/api/test_glance.py +++ b/openstack_dashboard/test/unit/api/test_glance.py @@ -16,9 +16,10 @@ # License for the specific language governing permissions and limitations # under the License. +from unittest import mock + from django.conf import settings from django.test.utils import override_settings -import mock from openstack_dashboard import api from openstack_dashboard.api import base diff --git a/openstack_dashboard/test/unit/api/test_keystone.py b/openstack_dashboard/test/unit/api/test_keystone.py index 5ed2aa420d..3513a1a7c0 100644 --- a/openstack_dashboard/test/unit/api/test_keystone.py +++ b/openstack_dashboard/test/unit/api/test_keystone.py @@ -17,8 +17,8 @@ # under the License. from __future__ import absolute_import +from unittest import mock -import mock from openstack_dashboard import api from openstack_dashboard.test import helpers as test diff --git a/openstack_dashboard/test/unit/api/test_microversions.py b/openstack_dashboard/test/unit/api/test_microversions.py index 0cf79407ca..732d698367 100644 --- a/openstack_dashboard/test/unit/api/test_microversions.py +++ b/openstack_dashboard/test/unit/api/test_microversions.py @@ -11,8 +11,8 @@ # under the License. import unittest +from unittest import mock -import mock from openstack_dashboard.api import microversions diff --git a/openstack_dashboard/test/unit/api/test_network.py b/openstack_dashboard/test/unit/api/test_network.py index bcabc1bddc..adda80f129 100644 --- a/openstack_dashboard/test/unit/api/test_network.py +++ b/openstack_dashboard/test/unit/api/test_network.py @@ -13,8 +13,8 @@ # under the License. import collections +from unittest import mock -import mock import netaddr from django.test.utils import override_settings diff --git a/openstack_dashboard/test/unit/api/test_neutron.py b/openstack_dashboard/test/unit/api/test_neutron.py index 959e0924f4..4a42b8d454 100644 --- a/openstack_dashboard/test/unit/api/test_neutron.py +++ b/openstack_dashboard/test/unit/api/test_neutron.py @@ -12,8 +12,8 @@ # License for the specific language governing permissions and limitations # under the License. import copy +from unittest import mock -import mock import netaddr from neutronclient.common import exceptions as neutron_exc from oslo_utils import uuidutils diff --git a/openstack_dashboard/test/unit/api/test_nova.py b/openstack_dashboard/test/unit/api/test_nova.py index 313b6fd92a..478a6bbabf 100644 --- a/openstack_dashboard/test/unit/api/test_nova.py +++ b/openstack_dashboard/test/unit/api/test_nova.py @@ -18,11 +18,11 @@ # under the License. from __future__ import absolute_import +from unittest import mock from django.conf import settings from django.test.utils import override_settings -import mock from novaclient import api_versions from novaclient import exceptions as nova_exceptions from novaclient.v2 import flavor_access as nova_flavor_access diff --git a/openstack_dashboard/test/unit/api/test_swift.py b/openstack_dashboard/test/unit/api/test_swift.py index e250bdf0f0..3e47643a21 100644 --- a/openstack_dashboard/test/unit/api/test_swift.py +++ b/openstack_dashboard/test/unit/api/test_swift.py @@ -17,8 +17,7 @@ # under the License. from __future__ import absolute_import - -import mock +from unittest import mock from horizon import exceptions diff --git a/openstack_dashboard/test/unit/usage/test_quotas.py b/openstack_dashboard/test/unit/usage/test_quotas.py index 46a5857fec..9d247a3414 100644 --- a/openstack_dashboard/test/unit/usage/test_quotas.py +++ b/openstack_dashboard/test/unit/usage/test_quotas.py @@ -20,10 +20,10 @@ from __future__ import absolute_import import collections +from unittest import mock from django.test.utils import override_settings from django.utils.translation import ugettext_lazy as _ -import mock from horizon import exceptions from openstack_dashboard import api diff --git a/test-requirements.txt b/test-requirements.txt index c6b84aa0c5..425b50751b 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -13,7 +13,6 @@ astroid==2.1.0 # LGPLv2.1 bandit!=1.6.0,>=1.4.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 flake8-import-order==0.12 # LGPLv3 -mock>=2.0.0 # BSD nodeenv>=0.9.4 # BSD python-memcached>=1.59 # PSF pylint==2.2.2 # GPLv2