aboutsummaryrefslogtreecommitdiffstats
path: root/tests/_autospec.py
diff options
context:
space:
mode:
authorGravatar shtlrs <[email protected]>2023-03-30 22:45:58 +0200
committerGravatar shtlrs <[email protected]>2023-03-30 22:45:58 +0200
commit73de98ad21950caba96d073175974f28bf9434ab (patch)
treedbe46753463c502efc09bab87479e855481bc490 /tests/_autospec.py
parentrename site_api to site_api_client inside NominationApi for better differenti... (diff)
parentBump sentry-sdk from 1.17.0 to 1.18.0 (#2497) (diff)
Merge branch 'main' into shtlrs/get-rid-of-site-config-var
Diffstat (limited to 'tests/_autospec.py')
-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: