]> granicus.if.org Git - python/commitdiff
doctest: fix _module_relative_path() error message
authorVictor Stinner <victor.stinner@gmail.com>
Fri, 25 Mar 2016 11:50:36 +0000 (12:50 +0100)
committerVictor Stinner <victor.stinner@gmail.com>
Fri, 25 Mar 2016 11:50:36 +0000 (12:50 +0100)
Write the module name rather than <module> in the error message, if module has
no __file__ attribute (ex: package).

Lib/doctest.py

index 409472384d6aa991804d4814933a67c7502fec39..38fdd80b4a495df179454cd2a020e63e1e56b549 100644 (file)
@@ -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('/')))