Commit 84ca9fe1 authored by Victor Stinner's avatar Victor Stinner

doctest: fix _module_relative_path() error message

Write the module name rather than <module> in the error message, if module has
no __file__ attribute (ex: package).
parent 8a208510
...@@ -399,8 +399,9 @@ def _module_relative_path(module, path): ...@@ -399,8 +399,9 @@ def _module_relative_path(module, path):
basedir = os.curdir basedir = os.curdir
else: else:
# A module w/o __file__ (this includes builtins) # A module w/o __file__ (this includes builtins)
raise ValueError("Can't resolve paths relative to the module " + raise ValueError("Can't resolve paths relative to the module "
module + " (it has no __file__)") "%r (it has no __file__)"
% module.__name__)
# Combine the base directory and the path. # Combine the base directory and the path.
return os.path.join(basedir, *(path.split('/'))) return os.path.join(basedir, *(path.split('/')))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment