Skip to content

Commit

Permalink
Better error message
Browse files Browse the repository at this point in the history
  • Loading branch information
Erotemic committed Jun 2, 2024
1 parent 06ac883 commit 14313ee
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/xdoctest/utils/util_import.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@ def _custom_import_modpath(modpath, index=-1):
with PythonPathContext(dpath, index=index):
module = import_module_from_name(modname)
except Exception as ex: # nocover
msg_parts = [
'ERROR: Failed to import modname={} with modpath={}'.format(
modname, modpath)
msg_parts = [(
'ERROR: Failed to import modname={} with modpath={} and '
'sys.path modified with {} at index={}').format(
modname, modpath, repr(dpath), index)
]
msg_parts.append('Caused by: {}'.format(repr(ex)))
raise RuntimeError('\n'.join(msg_parts))
Expand Down

0 comments on commit 14313ee

Please sign in to comment.