diff options
author | Victor Stinner <victor.stinner@gmail.com> | 2016-03-25 12:50:36 +0100 |
---|---|---|
committer | Victor Stinner <victor.stinner@gmail.com> | 2016-03-25 12:50:36 +0100 |
commit | f3efba6269c21707a5c893f5ef70519f2ce868da (patch) | |
tree | b0a713784b730f7df4962751505815a1f71bec66 | |
parent | 41467415e8259cc1545ee470de0ae9e3f28011e5 (diff) | |
download | cpython-f3efba6269c21707a5c893f5ef70519f2ce868da.tar.gz |
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).
-rw-r--r-- | Lib/doctest.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Lib/doctest.py b/Lib/doctest.py index 409472384d..38fdd80b4a 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('/'))) |