Contents Menu Expand Light mode Dark mode Auto light/dark, in light mode Auto light/dark, in dark mode Skip to content
Repomatic has been maintained for 4+ years, and is free to use. You can help if you 🀝 purchase business support or 🫢 sponsor the project.
Repomatic
Light Logo Dark Logo
  • Installation
  • CLI
  • Man pages
  • Configuration
  • Dependency management
  • Tool runner
  • Reusable workflows
  • Test matrix
  • Nuitka compilation
  • Security
  • Benchmark

Agent tooling

  • Agent skills
  • Subagents
    • grunt-qa
    • qa-engineer
    • sphinx-docs
  • Claude Code plugin

Contributing

  • Contributing
  • Commit messages
  • Packaging
  • Code of conduct

Developing repomatic

  • Upstream development
  • Automated operation contracts
  • Upstream

API reference

  • repomatic package
    • repomatic.cli package
      • repomatic.cli.ci module
      • repomatic.cli.deps module
      • repomatic.cli.github module
      • repomatic.cli.main module
      • repomatic.cli.release module
      • repomatic.cli.repo module
      • repomatic.cli.site module
      • repomatic.cli.tools module
    • repomatic.cloudflare package
      • repomatic.cloudflare.api module
      • repomatic.cloudflare.pages module
      • repomatic.cloudflare.r2 module
      • repomatic.cloudflare.redirects module
    • repomatic.data package
      • repomatic.data.awesome_template package
    • repomatic.deps package
      • repomatic.deps.audit module
      • repomatic.deps.cooldown module
      • repomatic.deps.graph module
      • repomatic.deps.lockfile module
      • repomatic.deps.pins module
      • repomatic.deps.policy module
      • repomatic.deps.provenance module
      • repomatic.deps.report module
      • repomatic.deps.requirements module
      • repomatic.deps.shippable module
      • repomatic.deps.sources module
      • repomatic.deps.sync module
      • repomatic.deps.uv module
    • repomatic.github package
      • repomatic.github.caches module
      • repomatic.github.ci_status module
      • repomatic.github.dev_release module
      • repomatic.github.event module
      • repomatic.github.gh module
      • repomatic.github.issue module
      • repomatic.github.job_timings module
      • repomatic.github.labels module
      • repomatic.github.outputs module
      • repomatic.github.pr module
      • repomatic.github.pr_body module
      • repomatic.github.release_sync module
      • repomatic.github.releases module
      • repomatic.github.runs module
      • repomatic.github.sponsor module
      • repomatic.github.status module
      • repomatic.github.threads module
      • repomatic.github.token module
      • repomatic.github.unsubscribe module
      • repomatic.github.urls module
      • repomatic.github.workflow_files module
      • repomatic.github.workflow_sync module
    • repomatic.init package
      • repomatic.init.local_edits module
      • repomatic.init.removed_assets module
      • repomatic.init.run module
      • repomatic.init.tool_config module
      • repomatic.init.upgrade module
    • repomatic.lint_repo package
      • repomatic.lint_repo.context module
      • repomatic.lint_repo.pins module
      • repomatic.lint_repo.repo module
      • repomatic.lint_repo.roster module
      • repomatic.lint_repo.settings module
      • repomatic.lint_repo.site module
      • repomatic.lint_repo.tool_config module
      • repomatic.lint_repo.workflows module
    • repomatic.matrix package
      • repomatic.matrix.axes module
      • repomatic.matrix.model module
      • repomatic.matrix.runner_sync module
      • repomatic.matrix.runners module
    • repomatic.metadata package
      • repomatic.metadata.core module
      • repomatic.metadata.env module
      • repomatic.metadata.git module
      • repomatic.metadata.matrix module
      • repomatic.metadata.output module
      • repomatic.metadata.project module
    • repomatic.metrics package
      • repomatic.metrics.chart module
      • repomatic.metrics.forge module
      • repomatic.metrics.store module
    • repomatic.release package
      • repomatic.release.attestation module
      • repomatic.release.binaries_page module
      • repomatic.release.binary module
      • repomatic.release.manpages module
      • repomatic.release.prepare_release module
      • repomatic.release.protocol module
      • repomatic.release.self_pin module
      • repomatic.release.verify module
      • repomatic.release.virustotal module
    • repomatic.templates package
    • repomatic.tooling package
      • repomatic.tooling.binaries module
      • repomatic.tooling.checksums module
      • repomatic.tooling.nuitka module
      • repomatic.tooling.registry module
      • repomatic.tooling.runner module
    • repomatic.awesome_toc module
    • repomatic.broken_links module
    • repomatic.bundle module
    • repomatic.cache module
    • repomatic.changelog module
    • repomatic.checks module
    • repomatic.claude_plugin module
    • repomatic.components module
    • repomatic.config module
    • repomatic.docs module
    • repomatic.file_inventory module
    • repomatic.file_ops module
    • repomatic.frontmatter module
    • repomatic.git_ops module
    • repomatic.gitignore module
    • repomatic.hashing module
    • repomatic.http module
    • repomatic.humanize module
    • repomatic.images module
    • repomatic.lint_changelog module
    • repomatic.mailmap module
    • repomatic.markdown module
    • repomatic.npm module
    • repomatic.pypi module
    • repomatic.pyproject module
    • repomatic.setup_guide module
    • repomatic.skills module
    • repomatic.tabular module
    • repomatic.templating module
    • repomatic.upstream module
    • repomatic.versions module
  • tests package
    • tests.conftest module
    • tests.test_attestation module
    • tests.test_awesome_template module
    • tests.test_awesome_toc module
    • tests.test_binaries module
    • tests.test_binaries_page module
    • tests.test_binary module
    • tests.test_broken_links module
    • tests.test_cache module
    • tests.test_changelog module
    • tests.test_checks module
    • tests.test_checksums module
    • tests.test_ci_status module
    • tests.test_claude_assets module
    • tests.test_cli module
    • tests.test_cloudflare module
    • tests.test_cloudflare_r2 module
    • tests.test_config module
    • tests.test_coverage_floor module
    • tests.test_dep_graph module
    • tests.test_dep_policy module
    • tests.test_dep_report module
    • tests.test_dep_sources module
    • tests.test_dev_release module
    • tests.test_docs module
    • tests.test_docstrings module
    • tests.test_event module
    • tests.test_file_ops module
    • tests.test_forge module
    • tests.test_frontmatter module
    • tests.test_gh module
    • tests.test_git_ops module
    • tests.test_github_caches module
    • tests.test_gitignore module
    • tests.test_hashing module
    • tests.test_help module
    • tests.test_http module
    • tests.test_humanize module
    • tests.test_images module
    • tests.test_imports module
    • tests.test_init_project module
    • tests.test_issue module
    • tests.test_job_timings module
    • tests.test_labels module
    • tests.test_lint_changelog module
    • tests.test_lint_repo module
    • tests.test_mailmap module
    • tests.test_manpages module
    • tests.test_markdown module
    • tests.test_matrix module
    • tests.test_metadata module
    • tests.test_metadata_git module
    • tests.test_metrics module
    • tests.test_npm module
    • tests.test_nuitka module
    • tests.test_outputs module
    • tests.test_pages_redirects module
    • tests.test_platform_keys module
    • tests.test_plugin module
    • tests.test_plugin_update_detection module
    • tests.test_pr module
    • tests.test_pr_body module
    • tests.test_prepare_release module
    • tests.test_protocol module
    • tests.test_provenance module
    • tests.test_pypi module
    • tests.test_pyproject module
    • tests.test_readme module
    • tests.test_release_sync module
    • tests.test_release_workflow_steps module
    • tests.test_releases module
    • tests.test_runner_catalog module
    • tests.test_runner_sync module
    • tests.test_runs module
    • tests.test_self_pin module
    • tests.test_setup_guide module
    • tests.test_skills module
    • tests.test_sphinx_crossrefs module
    • tests.test_sponsor module
    • tests.test_status module
    • tests.test_suite_hygiene module
    • tests.test_sync_ops module
    • tests.test_tabular module
    • tests.test_templating module
    • tests.test_threads module
    • tests.test_todolist module
    • tests.test_token module
    • tests.test_tool_runner module
    • tests.test_unsubscribe module
    • tests.test_upstream module
    • tests.test_urls module
    • tests.test_uv module
    • tests.test_verify module
    • tests.test_version_sync module
    • tests.test_versions module
    • tests.test_virustotal module
    • tests.test_vulnerable_deps module
    • tests.test_workflow_files module
    • tests.test_workflow_sync module
    • tests.test_workflows module
  • Index
  • Module Index

Release and hosting

  • Binaries
  • Cloudflare Pages

Project

  • Changelog
  • Changelog archive
  • History
  • Todo list
  • License
  • GitHub repository
  • Funding
Back to top
View this page
Edit this page

tests.test_broken_links moduleΒΆ

Tests for the broken links report: linkcheck parsing and the issue verdict.

tests.test_broken_links.test_get_label(repo, expected)[source]ΒΆ

Only a repo whose name starts with awesome- gets the fix-link label.

tests.test_broken_links.test_parse_output_json_empty_file(tmp_path)[source]ΒΆ

Empty file returns no results.

tests.test_broken_links.test_parse_output_json_skips_blank_lines(tmp_path)[source]ΒΆ

Blank lines in the file are skipped.

tests.test_broken_links.test_parse_output_json_single_entry(tmp_path)[source]ΒΆ

Single entry is parsed correctly.

tests.test_broken_links.test_parse_output_json_multiple_entries(tmp_path)[source]ΒΆ

Multiple entries are parsed correctly.

tests.test_broken_links.test_parse_output_json_missing_info_field(tmp_path)[source]ΒΆ

Missing info field defaults to empty string.

tests.test_broken_links.test_filter_by_status(status, expected_count)[source]ΒΆ

Only broken and timeout statuses are kept.

tests.test_broken_links.test_filter_broken_mixed_statuses()[source]ΒΆ

Only broken and timeout are kept from a mixed list.

tests.test_broken_links.test_filter_broken_empty_input()[source]ΒΆ

Empty input returns empty list.

tests.test_broken_links.test_report_empty_list()[source]ΒΆ

Empty list returns empty string.

tests.test_broken_links.test_report_single_broken_link()[source]ΒΆ

Single broken link generates a valid report.

tests.test_broken_links.test_report_groups_by_file_alphabetically()[source]ΒΆ

Results are grouped by filename in alphabetical order.

tests.test_broken_links.test_report_escapes_pipe_chars_in_info()[source]ΒΆ

Pipe characters in info are escaped to avoid breaking tables.

tests.test_broken_links.test_report_source_url_links_filenames_and_lines()[source]ΒΆ

When source_url is provided, filenames and line numbers are linked.

tests.test_broken_links.test_report_no_source_url_plain_text()[source]ΒΆ

Without source_url, filenames and line numbers are plain text.

tests.test_broken_links.test_report_leaves_external_content_unsanitized(info)[source]ΒΆ

The report renderer passes tool output through; the caller sanitizes it.

Splitting the two is what lets the same report be written to a file, where the mention would be inert, or posted to an issue, where it would not. test_lychee_output_sanitized covers the caller’s half.

tests.test_broken_links.test_lychee_output_sanitized(tmp_path)[source]ΒΆ

Lychee markdown output is sanitized before embedding in issue body.

tests.test_broken_links.test_lychee_section_reads_the_exit_code(exit_code, has_report, verdict, needle)[source]ΒΆ

Only exit 2 with a report reports broken links; 1 and 3 report nothing.

tests.test_broken_links.test_sphinx_section_reads_the_statuses(tmp_path, status, verdict)[source]ΒΆ

Any broken or timed-out link makes the Sphinx verdict broken.

tests.test_broken_links.test_a_failed_lychee_run_leaves_the_issue_alone(tmp_path, monkeypatch, exit_code)[source]ΒΆ

A run that did not complete never closes an open broken links issue.

It says nothing about the links, so claiming β€œNo more issues.” would close a report of links that may still be broken.

tests.test_broken_links.test_a_failed_lychee_run_beside_broken_sphinx_links_files_both(tmp_path, monkeypatch)[source]ΒΆ

Broken links found anywhere are filed, with the incomplete run said so.

tests.test_broken_links.test_a_completed_run_files_or_closes_the_issue(tmp_path, monkeypatch, exit_code, has_issues)[source]ΒΆ

A completed run decides the issue, either way.

tests.test_broken_links.test_a_ci_run_detects_every_default(tmp_path, monkeypatch)[source]ΒΆ

In CI, the name, the linkcheck output and its source URL are all detected.

tests.test_broken_links.test_no_repository_name_to_detect_is_an_error(tmp_path, monkeypatch)[source]ΒΆ

With neither $GITHUB_REPOSITORY nor a clone, no name selects the label.

tests.test_broken_links.test_no_checker_leaves_the_issue_alone(tmp_path, monkeypatch, caplog)[source]ΒΆ

With no checker run, nothing is known about the links: the issue stays.

No crawl and no Sphinx linkcheck output said a word about the links, so closing an open issue would announce fixes that nobody checked.

tests.test_broken_links.test_cli_with_no_checker_exits_clean(tmp_path, monkeypatch)[source]ΒΆ

--no-lychee with no linkcheck output leaves the issue, and exits 0.

The job is advisory: a run that checked nothing must not turn it red.

tests.test_broken_links.test_cli_without_a_repository_name_is_a_usage_error(tmp_path, monkeypatch)[source]ΒΆ

No --repo-name and nothing to detect one from fails before any check.

tests.test_broken_links.test_run_lychee_skips_a_repository_with_no_documentation(tmp_path, monkeypatch)[source]ΒΆ

With no documentation file, lychee has nothing to check and never runs.

tests.test_broken_links.test_run_lychee_reads_back_the_report_it_asked_for(tmp_path, monkeypatch)[source]ΒΆ

The crawl is the bare run lychee invocation, plus the report flags.

The report reaches the issue through the run itself, with no path agreed on with a workflow step.

tests.test_broken_links.test_run_lychee_without_a_report_says_so(tmp_path, monkeypatch)[source]ΒΆ

A crawl that wrote no report carries none, whatever its exit code.

tests.test_broken_links.test_run_lychee_that_cannot_install_did_not_complete(tmp_path, monkeypatch)[source]ΒΆ

A lychee that cannot be installed checked nothing: the issue stays put.

tests.test_broken_links.test_cli_crawls_unless_told_not_to(monkeypatch, flag, crawls)[source]ΒΆ

broken-links runs lychee itself, and --no-lychee leaves it out.

Next
tests.test_cache module
Previous
tests.test_binary module
Copyright © Kevin Deldycke and contributors
Made with Furo
Last updated on 2026-11-11
On this page
  • tests.test_broken_links module
    • test_get_label()
    • test_parse_output_json_empty_file()
    • test_parse_output_json_skips_blank_lines()
    • test_parse_output_json_single_entry()
    • test_parse_output_json_multiple_entries()
    • test_parse_output_json_missing_info_field()
    • test_filter_by_status()
    • test_filter_broken_mixed_statuses()
    • test_filter_broken_empty_input()
    • test_report_empty_list()
    • test_report_single_broken_link()
    • test_report_groups_by_file_alphabetically()
    • test_report_escapes_pipe_chars_in_info()
    • test_report_source_url_links_filenames_and_lines()
    • test_report_no_source_url_plain_text()
    • test_report_leaves_external_content_unsanitized()
    • test_lychee_output_sanitized()
    • test_lychee_section_reads_the_exit_code()
    • test_sphinx_section_reads_the_statuses()
    • test_a_failed_lychee_run_leaves_the_issue_alone()
    • test_a_failed_lychee_run_beside_broken_sphinx_links_files_both()
    • test_a_completed_run_files_or_closes_the_issue()
    • test_a_ci_run_detects_every_default()
    • test_no_repository_name_to_detect_is_an_error()
    • test_no_checker_leaves_the_issue_alone()
    • test_cli_with_no_checker_exits_clean()
    • test_cli_without_a_repository_name_is_a_usage_error()
    • test_run_lychee_skips_a_repository_with_no_documentation()
    • test_run_lychee_reads_back_the_report_it_asked_for()
    • test_run_lychee_without_a_report_says_so()
    • test_run_lychee_that_cannot_install_did_not_complete()
    • test_cli_crawls_unless_told_not_to()