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. Change-Id: If62bed2598c42b861a11ceab21e9f1ab0c0cf9dd
This commit is contained in:
parent
f59a409c01
commit
3a23930bb6
@ -1,4 +1,4 @@
|
|||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- openstack-python3-charm-jobs
|
- openstack-python3-ussuri-jobs
|
||||||
- openstack-cover-jobs
|
- openstack-cover-jobs
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
- project:
|
- project:
|
||||||
templates:
|
templates:
|
||||||
- charm-unit-jobs
|
- charm-yoga-unit-jobs
|
||||||
check:
|
check:
|
||||||
jobs:
|
jobs:
|
||||||
- bionic-octopus
|
- bionic-octopus
|
||||||
@ -15,10 +15,9 @@
|
|||||||
parent: func-target
|
parent: func-target
|
||||||
dependencies:
|
dependencies:
|
||||||
- osci-lint
|
- osci-lint
|
||||||
- tox-py35
|
|
||||||
- tox-py36
|
- tox-py36
|
||||||
- tox-py37
|
|
||||||
- tox-py38
|
- tox-py38
|
||||||
|
- tox-py39
|
||||||
vars:
|
vars:
|
||||||
tox_extra_args: focal
|
tox_extra_args: focal
|
||||||
- job:
|
- job:
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
# requirements management in charms via bot-control. Thank you.
|
# requirements management in charms via bot-control. Thank you.
|
||||||
charm-tools>=2.4.4
|
charm-tools>=2.4.4
|
||||||
coverage>=3.6
|
coverage>=3.6
|
||||||
mock>=1.2
|
|
||||||
flake8>=2.2.4,<=2.4.1
|
flake8>=2.2.4,<=2.4.1
|
||||||
pyflakes==2.1.1
|
pyflakes==2.1.1
|
||||||
stestr>=2.2.0
|
stestr>=2.2.0
|
||||||
|
5
tox.ini
5
tox.ini
@ -57,6 +57,11 @@ basepython = python3.8
|
|||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
-r{toxinidir}/test-requirements.txt
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
|
[testenv:py39]
|
||||||
|
basepython = python3.9
|
||||||
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
-r{toxinidir}/test-requirements.txt
|
||||||
|
|
||||||
[testenv:py3]
|
[testenv:py3]
|
||||||
basepython = python3
|
basepython = python3
|
||||||
deps = -r{toxinidir}/requirements.txt
|
deps = -r{toxinidir}/requirements.txt
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
import sys
|
import sys
|
||||||
import mock
|
import unittest.mock as mock
|
||||||
|
|
||||||
# Mock out secrets to make py35 happy.
|
# Mock out secrets to make py35 happy.
|
||||||
sys.modules['secrets'] = mock.MagicMock()
|
sys.modules['secrets'] = mock.MagicMock()
|
||||||
|
@ -22,7 +22,7 @@ import sys
|
|||||||
sys.path.append('lib') # noqa
|
sys.path.append('lib') # noqa
|
||||||
sys.path.append('src') # noqa
|
sys.path.append('src') # noqa
|
||||||
|
|
||||||
from mock import ANY, call, patch, MagicMock
|
from unittest.mock import ANY, call, patch, MagicMock
|
||||||
|
|
||||||
from ops.testing import Harness, _TestingModelBackend
|
from ops.testing import Harness, _TestingModelBackend
|
||||||
from ops.model import (
|
from ops.model import (
|
||||||
|
Loading…
Reference in New Issue
Block a user