From b6a87a6a103230f07c368ba444d5e2dab5ddd75a Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Tue, 25 Jul 2017 14:29:09 +0200 Subject: [PATCH 1/2] 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. --- Lib/test/test_pydoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 6813d153e1e9f2..628d0cbbe26174 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -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.abspath(__file__))) doc = pydoc.TextDoc() loc = doc.getdocloc(module, basedir=basedir) return loc From a70f61391f15b8d8bac8d9ea212395c3435be053 Mon Sep 17 00:00:00 2001 From: Victor Stinner Date: Wed, 26 Jul 2017 00:03:21 +0200 Subject: [PATCH 2/2] Use realpath() instead of abspath() --- Lib/test/test_pydoc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Lib/test/test_pydoc.py b/Lib/test/test_pydoc.py index 628d0cbbe26174..d68ab5595e877b 100644 --- a/Lib/test/test_pydoc.py +++ b/Lib/test/test_pydoc.py @@ -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(os.path.abspath(__file__))) + basedir = dirname(dirname(os.path.realpath(__file__))) doc = pydoc.TextDoc() loc = doc.getdocloc(module, basedir=basedir) return loc