Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/check_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def check_local_links() -> None:
continue
resolved = (doc.parent / path_part).resolve()
if not resolved.exists():
errors.append(f"{doc.name}: broken relative link -> {target}")
errors.append(f"{doc.relative_to(REPO_ROOT).as_posix()}: broken relative link -> {target}")


def main() -> int:
Expand Down
13 changes: 12 additions & 1 deletion tests/test_check_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,18 @@ def test_link_resolves_relative_to_containing_doc(self):
(root / "docs" / "SAME.md").write_text("[link](TARGET.md)")
check_docs.REPO_ROOT = root
check_docs.check_local_links()
self.assertEqual(check_docs.errors, ["SAME.md: broken relative link -> TARGET.md"])
self.assertEqual(check_docs.errors, ["docs/SAME.md: broken relative link -> TARGET.md"])

def test_same_named_docs_are_told_apart_by_path(self):
import tempfile
with tempfile.TemporaryDirectory() as tmp:
root = Path(tmp)
(root / "scripts").mkdir()
(root / "README.md").write_text("no links here")
(root / "scripts" / "README.md").write_text("[link](MISSING.md)")
check_docs.REPO_ROOT = root
check_docs.check_local_links()
self.assertEqual(check_docs.errors, ["scripts/README.md: broken relative link -> MISSING.md"])

def test_docs_under_dot_git_are_skipped(self):
import tempfile
Expand Down
Loading