aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorGravatar Boris Muratov <[email protected]>2023-04-01 02:46:15 +0300
committerGravatar GitHub <[email protected]>2023-04-01 02:46:15 +0300
commit06af38ac1fc988c211c5670594096d4b57d83746 (patch)
treecc7f2e29671f3f83290b3cd3608122686bbea547 /tests
parentAvoid race conditions and stricter cooldown (diff)
parentMerge pull request #2467 from shtlrs/native-forum-channel-support (diff)
Merge branch 'main' into helper-role
Diffstat (limited to 'tests')
-rw-r--r--tests/_autospec.py3
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: