summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTakeshi KOMIYA <i.tkomiya@gmail.com>2021-10-01 02:41:17 +0900
committerGitHub <noreply@github.com>2021-10-01 02:41:17 +0900
commitea8b3d3d5f8545c30ff548557d25291f8a92843f (patch)
tree06e70a5dbacc0676b8d16979b1bfa4a4a27437cf
parentb639b1d7515b8b3702371a1903a319eef8e0269f (diff)
parent36a6fcaef1179d40129b98e16794360dc6f90223 (diff)
downloadsphinx-git-ea8b3d3d5f8545c30ff548557d25291f8a92843f.tar.gz
Merge pull request #9678 from hoefling/fix-linkcheck-warnings
Don't print file extension twice in linkcheck warnings
-rw-r--r--sphinx/builders/linkcheck.py4
-rw-r--r--tests/test_build_linkcheck.py2
2 files changed, 3 insertions, 3 deletions
diff --git a/sphinx/builders/linkcheck.py b/sphinx/builders/linkcheck.py
index 58e5da94b..a6e7b2a96 100644
--- a/sphinx/builders/linkcheck.py
+++ b/sphinx/builders/linkcheck.py
@@ -255,7 +255,7 @@ class CheckExternalLinksBuilder(DummyBuilder):
elif result.status == 'broken':
if self.app.quiet or self.app.warningiserror:
logger.warning(__('broken link: %s (%s)'), result.uri, result.message,
- location=(filename, result.lineno))
+ location=(result.docname, result.lineno))
else:
logger.info(red('broken ') + result.uri + red(' - ' + result.message))
self.write_entry('broken', result.docname, filename, result.lineno,
@@ -274,7 +274,7 @@ class CheckExternalLinksBuilder(DummyBuilder):
linkstat['text'] = text
if self.config.linkcheck_allowed_redirects:
logger.warning('redirect ' + result.uri + ' - ' + text + ' to ' +
- result.message, location=(filename, result.lineno))
+ result.message, location=(result.docname, result.lineno))
else:
logger.info(color('redirect ') + result.uri +
color(' - ' + text + ' to ' + result.message))
diff --git a/tests/test_build_linkcheck.py b/tests/test_build_linkcheck.py
index 2c6244b0a..fa7af13a4 100644
--- a/tests/test_build_linkcheck.py
+++ b/tests/test_build_linkcheck.py
@@ -305,7 +305,7 @@ def test_linkcheck_allowed_redirects(app, warning):
assert result["http://localhost:7777/path1"] == "working"
assert result["http://localhost:7777/path2"] == "redirected"
- assert ("index.rst.rst:1: WARNING: redirect http://localhost:7777/path2 - with Found to "
+ assert ("index.rst:1: WARNING: redirect http://localhost:7777/path2 - with Found to "
"http://localhost:7777/?redirected=1\n" in strip_escseq(warning.getvalue()))
assert len(warning.getvalue().splitlines()) == 1