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: I30e82e2d87418272a71c7ee089a8acdaf8872158
This commit is contained in:
Radosław Piliszek 2020-04-02 18:12:37 +02:00
parent 47e2baf9f4
commit 5648ad6e9d
4 changed files with 3 additions and 7 deletions

View File

@ -13,9 +13,9 @@
# under the License. # under the License.
import unittest import unittest
from unittest import mock
import jinja2 import jinja2
import mock
from kolla_ansible import exception from kolla_ansible import exception
from kolla_ansible import filters from kolla_ansible import filters

View File

@ -39,7 +39,6 @@ keystoneauth1==3.4.0
linecache2==1.0.0 linecache2==1.0.0
MarkupSafe==1.0 MarkupSafe==1.0
mccabe==0.2.1 mccabe==0.2.1
mock==2.0.0
monotonic==1.4 monotonic==1.4
mox3==0.25.0 mox3==0.25.0
msgpack==0.5.6 msgpack==0.5.6

View File

@ -19,11 +19,8 @@ import copy
import imp import imp
import os import os
import sys import sys
from unittest import mock
try:
from unittest import mock
except ImportError:
import mock
from docker import errors as docker_error from docker import errors as docker_error
from docker.types import Ulimit from docker.types import Ulimit
from oslotest import base from oslotest import base

View File

@ -16,9 +16,9 @@
import imp import imp
import os import os
import sys import sys
from unittest import mock
from io import StringIO from io import StringIO
import mock
from oslotest import base from oslotest import base