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.

Note that https://github.com/openstack/charms.openstack is used during tests
and he need `mock`, unfortunatelly it doesn't declare `mock` in its
requirements so it retrieve mock from other charm project (cross dependency).
So we depend on charms.openstack first and when
Ib1ed5b598a52375e29e247db9ab4786df5b6d142 will be merged then CI
will pass without errors.

Depends-On: Ib1ed5b598a52375e29e247db9ab4786df5b6d142
Change-Id: If34c7c237f705b7b78261ccd0fc4a1655663300a
This commit is contained in:
Hervé Beraud 2020-06-08 22:30:42 +02:00 committed by James Page
parent b455c46541
commit 0446879a1e
4 changed files with 2 additions and 9 deletions

View File

@ -1,6 +1,4 @@
- project:
templates:
- python35-charm-jobs
- openstack-python35-jobs
- openstack-python3-ussuri-jobs
- openstack-cover-jobs

View File

@ -28,11 +28,6 @@ oslo.utils<=3.41.0;python_version<'3.6'
requests>=2.18.4
charms.reactive
# Newer mock seems to have some syntax which is newer than python3.5 (e.g.
# f'{something}'
mock>=1.2,<4.0.0; python_version < '3.6'
mock>=1.2; python_version >= '3.6'
nose>=1.3.7
coverage>=3.6
git+https://github.com/openstack/charms.openstack.git#egg=charms.openstack

View File

@ -2,7 +2,7 @@ import sys
sys.path.append('src/actions')
import unittest
from mock import patch, call, Mock
from unittest.mock import patch, call, Mock
__author__ = 'Chris Holcombe <chris.holcombe@canonical.com>'

View File

@ -17,7 +17,7 @@ import unittest
import os
import yaml
from mock import patch
from unittest.mock import patch
def load_config():