diff options
author | 2023-03-29 18:44:48 +0100 | |
---|---|---|
committer | 2023-03-29 18:44:48 +0100 | |
commit | 40ee2676be420417a327c39da7c9f957078e673d (patch) | |
tree | 6863319659799c6173872abf838b1a427faf9fb3 /tests/_autospec.py | |
parent | Merge pull request #2487 from python-discord/wookie184-botstrap-error (diff) | |
parent | Replace mock._importer with pkgutil.resolve_name in test autospec (diff) |
Merge pull request #2432 from shtlrs/bump-python-version-to-3-11
Bump python version to 3 11
Diffstat (limited to 'tests/_autospec.py')
-rw-r--r-- | tests/_autospec.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/tests/_autospec.py b/tests/_autospec.py index ee2fc1973..ecff6bcbe 100644 --- a/tests/_autospec.py +++ b/tests/_autospec.py @@ -1,5 +1,6 @@ import contextlib import functools +import pkgutil import unittest.mock from typing import Callable @@ -51,7 +52,7 @@ def autospec(target, *attributes: str, pass_mocks: bool = True, **patch_kwargs) # Import the target if it's a string. # This is to support both object and string targets like patch.multiple. if type(target) is str: - target = unittest.mock._importer(target) + target = pkgutil.resolve_name(target) def decorator(func): for attribute in attributes: |