]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
bpo-31028: Fix test_pydoc when run directly (#2864)
authorVictor Stinner <victor.stinner@gmail.com>
Thu, 27 Jul 2017 09:21:26 +0000 (11:21 +0200)
committerGitHub <noreply@github.com>
Thu, 27 Jul 2017 09:21:26 +0000 (11:21 +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()

Lib/test/test_pydoc.py

index 6813d153e1e9f28b589683a3244271fc24ea8d7e..d68ab5595e877b6e7db839c90ca5307a79d679c1 100644 (file)
@@ -360,7 +360,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