mirror of https://github.com/ansible/ansible.git
Prefer unittest.mock over mock. (#77886)
parent
3a9a23fb1a
commit
2595b42aca
@ -0,0 +1,23 @@
|
|||||||
|
"""
|
||||||
|
Compatibility shim for mock imports in modules and module_utils.
|
||||||
|
This can be removed once support for Python 2.7 is dropped.
|
||||||
|
"""
|
||||||
|
from __future__ import (absolute_import, division, print_function)
|
||||||
|
__metaclass__ = type
|
||||||
|
|
||||||
|
try:
|
||||||
|
from unittest.mock import (
|
||||||
|
call,
|
||||||
|
patch,
|
||||||
|
mock_open,
|
||||||
|
MagicMock,
|
||||||
|
Mock,
|
||||||
|
)
|
||||||
|
except ImportError:
|
||||||
|
from mock import (
|
||||||
|
call,
|
||||||
|
patch,
|
||||||
|
mock_open,
|
||||||
|
MagicMock,
|
||||||
|
Mock,
|
||||||
|
)
|
||||||
Loading…
Reference in New Issue