]> granicus.if.org Git - python/commitdiff
bpo-31028: Fix test_pydoc when run directly (#2864) (#2911)
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 27 Jul 2017 16:05:44 +0000 (18:05 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Jul 2017 16:05:44 +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 7188d0af75a1342673df3d6a3a3eadda22a2b08c..83aad0b3b4aada57e9445d5ba0c84aa2039835a3 100644 (file)
@@ -257,7 +257,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