You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible/test/units/compat/mock.py

23 lines
456 B
Python

"""
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 annotations
try:
from unittest.mock import ( # pylint: disable=unused-import
call,
patch,
mock_open,
MagicMock,
Mock,
)
except ImportError:
from mock import (
call,
patch,
mock_open,
MagicMock,
Mock,
)