[Python-checkins] bpo-31028: Fix test_pydoc when run directly (#2864) (#2911)

Victor Stinner webhook-mailer at python.org
Thu Jul 27 12:05:47 EDT 2017


https://github.com/python/cpython/commit/fd6736d17901e539d6a9ddf50a9927a3a97a9c06
commit: fd6736d17901e539d6a9ddf50a9927a3a97a9c06
branch: 2.7
author: Victor Stinner <victor.stinner at gmail.com>
committer: GitHub <noreply at github.com>
date: 2017-07-27T18:05:44+02:00
summary:

bpo-31028: Fix test_pydoc when run directly (#2864) (#2911)

* 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)

files:
M Lib/test/test_pydoc.py

diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py
index 7188d0af75a..83aad0b3b4a 100644
--- a/Lib/test/test_pydoc.py
+++ b/Lib/test/test_pydoc.py
@@ -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



More information about the Python-checkins mailing list