Fix error with --import-mode=importlib and modules containing dataclasses or pickle (#7870)
Co-authored-by: Bruno Oliveira <nicoddemus@gmail.com> Fixes #7856, fixes #7859
This commit is contained in:
@@ -577,7 +577,7 @@ class Module(nodes.File, PyCollector):
|
||||
# We assume we are only called once per module.
|
||||
importmode = self.config.getoption("--import-mode")
|
||||
try:
|
||||
mod = import_path(self.path, mode=importmode)
|
||||
mod = import_path(self.path, mode=importmode, root=self.config.rootpath)
|
||||
except SyntaxError as e:
|
||||
raise self.CollectError(
|
||||
ExceptionInfo.from_current().getrepr(style="short")
|
||||
|
||||
Reference in New Issue
Block a user