summaryrefslogtreecommitdiffstats
path: root/Lib/doctest.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@gmail.com>2016-03-25 11:50:36 (GMT)
committerVictor Stinner <victor.stinner@gmail.com>2016-03-25 11:50:36 (GMT)
commit84ca9fe14533d7fca2cf5c18d3cba3e72c8204ae (patch)
tree834fe088798ee75d48dac5e95cb4771b72f4e6af /Lib/doctest.py
parent8a208510104a0ac5a34240ae4329b881ffcee998 (diff)
downloadcpython-84ca9fe14533d7fca2cf5c18d3cba3e72c8204ae.zip
cpython-84ca9fe14533d7fca2cf5c18d3cba3e72c8204ae.tar.gz
cpython-84ca9fe14533d7fca2cf5c18d3cba3e72c8204ae.tar.bz2
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).
Diffstat (limited to 'Lib/doctest.py')
-rw-r--r--Lib/doctest.py5
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py
index 4094723..38fdd80 100644
--- a/Lib/doctest.py
+++ b/Lib/doctest.py
@@ -399,8 +399,9 @@ def _module_relative_path(module, path):
basedir = os.curdir
else:
# A module w/o __file__ (this includes builtins)
- raise ValueError("Can't resolve paths relative to the module " +
- module + " (it has no __file__)")
+ raise ValueError("Can't resolve paths relative to the module "
+ "%r (it has no __file__)"
+ % module.__name__)
# Combine the base directory and the path.
return os.path.join(basedir, *(path.split('/')))