mirror of https://github.com/ansible/ansible.git
[stable-2.13] Prefer unittest.mock over mock. (#77886)
(cherry picked from commit 2595b42aca)
Co-authored-by: Matt Clay <matt@mystile.com>
pull/77899/head
parent
47e1cc38fd
commit
46a1eb6832
@ -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