From ca55abec235657bc14793aa768553a2b3d97ceb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20Beraud?= Date: Tue, 9 Jun 2020 01:26:07 +0200 Subject: [PATCH] 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. Bump horizon to 18.3.0 in lower-constraints.txt since it is the first version with "Use unittest.mock instead of third party mock" change [1] [1] https://opendev.org/openstack/horizon/commit/7eeb9e14f9377e2572c6073dd246e0d3b3933861 Change-Id: Ic64fffaeded18ac11ce438c77526e60a37aeaa1d --- lower-constraints.txt | 3 +-- monitoring/alarmdefs/tests.py | 2 +- monitoring/alarms/tests.py | 2 +- monitoring/notifications/tests.py | 2 +- monitoring/test/helpers.py | 2 +- monitoring/test/test_alarm_tables.py | 2 +- monitoring/test/test_client.py | 4 ++-- test-requirements.txt | 1 - 8 files changed, 8 insertions(+), 10 deletions(-) diff --git a/lower-constraints.txt b/lower-constraints.txt index cb2ca9db..ea25c29c 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -28,7 +28,7 @@ fixtures==3.0.0 funcsigs==1.0.0 futurist==1.2.0 greenlet==0.4.10 -horizon==17.1.0 +horizon==18.3.0 idna==2.6 imagesize==0.7.1 iso8601==0.1.11 @@ -42,7 +42,6 @@ kombu==4.0.0 linecache2==1.0.0 MarkupSafe==1.0 mccabe==0.2.1 -mock==2.0.0 monotonic==0.6 mox3==0.20.0 msgpack-python==0.4.0 diff --git a/monitoring/alarmdefs/tests.py b/monitoring/alarmdefs/tests.py index 334f199b..b3756334 100644 --- a/monitoring/alarmdefs/tests.py +++ b/monitoring/alarmdefs/tests.py @@ -14,7 +14,7 @@ # under the License. from django.urls import reverse -from mock import patch +from unittest.mock import patch from monitoring.alarmdefs import constants from monitoring.alarmdefs import views diff --git a/monitoring/alarms/tests.py b/monitoring/alarms/tests.py index 39900273..cce6254a 100644 --- a/monitoring/alarms/tests.py +++ b/monitoring/alarms/tests.py @@ -11,7 +11,7 @@ # under the License. from django.urls import reverse -from mock import patch +from unittest.mock import patch from monitoring.alarms import constants from monitoring.alarms import tables diff --git a/monitoring/notifications/tests.py b/monitoring/notifications/tests.py index 01076bae..10c1051c 100644 --- a/monitoring/notifications/tests.py +++ b/monitoring/notifications/tests.py @@ -11,7 +11,7 @@ # under the License. from django.urls import reverse -from mock import patch +from unittest.mock import patch from monitoring.notifications import constants from monitoring.test import helpers diff --git a/monitoring/test/helpers.py b/monitoring/test/helpers.py index d385487b..1f05bd29 100644 --- a/monitoring/test/helpers.py +++ b/monitoring/test/helpers.py @@ -16,8 +16,8 @@ import unittest import warnings from django.core.handlers import wsgi -import mock from openstack_dashboard.test import helpers +from unittest import mock from monitoring.test.test_data import utils as test_data_utils diff --git a/monitoring/test/test_alarm_tables.py b/monitoring/test/test_alarm_tables.py index e549ae62..c89f8654 100644 --- a/monitoring/test/test_alarm_tables.py +++ b/monitoring/test/test_alarm_tables.py @@ -14,7 +14,7 @@ from django.test import TestCase from django.test.utils import override_settings -from mock import Mock +from unittest.mock import Mock import monitoring.alarms.tables diff --git a/monitoring/test/test_client.py b/monitoring/test/test_client.py index 1ccd24c0..267a1ff2 100644 --- a/monitoring/test/test_client.py +++ b/monitoring/test/test_client.py @@ -16,8 +16,8 @@ from django.conf import settings as d_settings from django.test.utils import override_settings -from mock import Mock -from mock import patch +from unittest.mock import Mock +from unittest.mock import patch from monascaclient import client as mon_client from monascaclient import v2_0 diff --git a/test-requirements.txt b/test-requirements.txt index dc96086c..54f4306d 100644 --- a/test-requirements.txt +++ b/test-requirements.txt @@ -5,7 +5,6 @@ hacking>=3.0.1,<3.1.0 # Apache-2.0 coverage!=4.4,>=4.0 # Apache-2.0 -mock>=2.0.0 # BSD nodeenv>=0.9.4 # BSD selenium>=2.50.1 # Apache-2.0