From 924e7a40f185fd3116d593ba0353046bd7c81e1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rados=C5=82aw=20Piliszek?= Date: Thu, 2 Apr 2020 18:22:38 +0200 Subject: [PATCH] Use unittest.mock instead of PyPI mock Now that py2 is gone, oslotest dropped dependency on mock and will soon affect Ussuri CI [1], let's use unittest.mock built in py3. This also fixes py38 jobs and proactively prevents py36 and py37 failing due to [1]. This is because we never included mock in test-requirements (but in lower-constraints where it does not really belong at all) and instead relied on oslotest to bring it in. [1] https://review.opendev.org/716322 Change-Id: Iceedcc7ad0d087414f6f94dfc0235fda4754be63 --- kolla/tests/base.py | 2 +- kolla/tests/test_build.py | 2 +- lower-constraints.txt | 1 - tests/test_build.py | 2 +- tests/test_set_config.py | 2 +- 5 files changed, 4 insertions(+), 5 deletions(-) diff --git a/kolla/tests/base.py b/kolla/tests/base.py index 1c43b76196..94bdba509a 100644 --- a/kolla/tests/base.py +++ b/kolla/tests/base.py @@ -11,9 +11,9 @@ # limitations under the License. import os +from unittest import mock import fixtures -import mock from oslo_config import cfg from oslotest import base as oslotest_base diff --git a/kolla/tests/test_build.py b/kolla/tests/test_build.py index 5b3e981d6f..b7f5c30c08 100644 --- a/kolla/tests/test_build.py +++ b/kolla/tests/test_build.py @@ -12,10 +12,10 @@ import fixtures import itertools -import mock import os import requests import sys +from unittest import mock from kolla.cmd import build as build_cmd from kolla import exception diff --git a/lower-constraints.txt b/lower-constraints.txt index 2d24ad02b2..33e8abcce5 100644 --- a/lower-constraints.txt +++ b/lower-constraints.txt @@ -37,7 +37,6 @@ keystoneauth1==3.4.0 linecache2==1.0.0 MarkupSafe==1.0 mccabe==0.2.1 -mock==2.0.0 monotonic==1.4 mox3==0.25.0 msgpack==0.5.6 diff --git a/tests/test_build.py b/tests/test_build.py index 632931ee4c..c4a4a6aed8 100644 --- a/tests/test_build.py +++ b/tests/test_build.py @@ -13,8 +13,8 @@ import multiprocessing import os import sys +from unittest.mock import patch -from mock import patch from oslo_log import fixture as log_fixture from oslo_log import log as logging from oslotest import base diff --git a/tests/test_set_config.py b/tests/test_set_config.py index e4706c99d6..7016d8fa36 100644 --- a/tests/test_set_config.py +++ b/tests/test_set_config.py @@ -13,9 +13,9 @@ import copy import imp import json -import mock import os.path import sys +from unittest import mock from oslotest import base