From: Victor Stinner Date: Fri, 25 Mar 2016 11:50:36 +0000 (+0100) Subject: doctest: fix _module_relative_path() error message X-Git-Tag: v3.6.0a1~329^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=84ca9fe14533d7fca2cf5c18d3cba3e72c8204ae;p=python doctest: fix _module_relative_path() error message Write the module name rather than in the error message, if module has no __file__ attribute (ex: package). --- 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('/')))