tests.sphinx.test_sphinx_changelog moduleΒΆ

Tests for the anchors of changelog releases.

tests.sphinx.test_sphinx_changelog.MYST_CHANGELOG = '# Changelog\n\nSee the [next release](#v1-5-0).\n\n## [`1.5.0.dev0` (unreleased)](https://example.com/compare/v1.4.2...main)\n\n- Plant a pear tree.\n\n## [`1.4.2` (2026-03-15)](https://example.com/compare/v1.4.1...v1.4.2)\n\n- Prune the apple trees.\n\n## `1.4.1` (2026-02-01)\n\n- Water the plums.\n'ΒΆ

A MyST changelog, one release titled as a link, one as plain text.

tests.sphinx.test_sphinx_changelog.LETTERLESS_CHANGELOG = '# 2026\n\n## `1.4.2` (2026-03-15)\n\n- Prune the apple trees.\n\n## `1.4.1` (2026-02-01)\n\n- Water the plums.\n'ΒΆ

A MyST changelog whose headings all have no letters, so no heading slug.

tests.sphinx.test_sphinx_changelog.RST_CHANGELOG = 'Changelog\n=========\n\n1.5.0.dev0 (unreleased)\n-----------------------\n\n- Plant a pear tree.\n\n1.4.2 (2026-03-15)\n------------------\n\n- Prune the apple trees.\n\n1.4.1 (2026-02-01)\n------------------\n\n- Water the plums.\n'ΒΆ

The same changelog in reStructuredText.

tests.sphinx.test_sphinx_changelog.ORCHARD_PAGE = '# Orchard\n\nThe trees were [last pruned](changelog.md#v1-4-2).\n'ΒΆ

A MyST page linking to a release of the changelog page.

tests.sphinx.test_sphinx_changelog.build(tmp_path, pages, *, anchors=None)[source]ΒΆ

Build pages, a map of file names to sources, and return the output.

anchors sets RELEASE_ANCHORS_CONFIG, left to its default when None. Returns the output directory and the warning stream.

tests.sphinx.test_sphinx_changelog.test_release_heading(title, version)[source]ΒΆ

Only a title made of a full version and a parenthesized label matches.

tests.sphinx.test_sphinx_changelog.test_releases_are_anchored_on_their_version(tmp_path, page)[source]ΒΆ

Each release section takes its version as ID, the one in preparation too.

A link to a version anchor resolves, from the changelog and from another page.

A link resolves to a release on a page where no heading has a slug.

tests.sphinx.test_sphinx_changelog.test_release_anchors_are_off_by_default(tmp_path)[source]ΒΆ

Without the opt-in, each release keeps the ID docutils gave it.