We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5af46f3 commit 7ef1897Copy full SHA for 7ef1897
src/_pytest/pathlib.py
@@ -540,7 +540,7 @@ def import_path(
540
# Try to import this module using the standard import mechanisms, but
541
# without touching sys.path.
542
try:
543
- pkg_root, module_name = resolve_pkg_root_and_module_name(
+ _, module_name = resolve_pkg_root_and_module_name(
544
path, consider_namespace_packages=consider_namespace_packages
545
)
546
except CouldNotResolvePathError:
@@ -551,7 +551,7 @@ def import_path(
551
return sys.modules[module_name]
552
553
mod = _import_module_using_spec(
554
- module_name, path, pkg_root, insert_modules=False
+ module_name, path, path.parent, insert_modules=False
555
556
if mod is not None:
557
return mod
0 commit comments