]> granicus.if.org Git - python/commitdiff
bpo-31028: Fix test_pydoc when run directly (#2864) (#2910)
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 27 Jul 2017 16:05:46 +0000 (18:05 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Jul 2017 16:05:46 +0000 (18:05 +0200)
* bpo-31028: Fix test_pydoc when run directly

Fix get_pydoc_link() of test_pydoc to fix "./python
Lib/test/test_pydoc.py": get the absolute path to __file__ to prevent
relative directories.

* Use realpath() instead of abspath()

(cherry picked from commit fd46561167af6cd697191dd7ebb8c2fef5ad6493)

Lib/test/test_pydoc.py

index ed438d5664c7c0bede79f963d0ef358ab53d34dc..0383a6732401be1880c987b5fc328c6365db4bcf 100644 (file)
@@ -361,7 +361,7 @@ def get_pydoc_html(module):
 def get_pydoc_link(module):
     "Returns a documentation web link of a module"
     dirname = os.path.dirname
-    basedir = dirname(dirname(__file__))
+    basedir = dirname(dirname(os.path.realpath(__file__)))
     doc = pydoc.TextDoc()
     loc = doc.getdocloc(module, basedir=basedir)
     return loc