tests.test_docs_api moduleΒΆ

Every public module is indexed on its own API page, and only there.

sphinx-apidoc writes the API pages with --separate: one page per module, like docs/click_extra.color.md, and one per package, like docs/click_extra.md, whose toctree lists the pages below it. A later run keeps each page already in place, as click_extra.markdown.myst.convert_rst_files_in_directory() does, and adds the page of a new module. A guide page teaches its subject and carries no autodoc block: the class tree of a module sits on its API page, above its members, so all the API documentation of a module stays together.

This test reads the source trees and the pages as text. It fails naming each public module that no API page indexes, and each guide page that carries an automodule or autoclasstree block. The check imports nothing, so it needs none of the optional dependencies a module pulls in.

tests.test_docs_api.public_modules(package)[source]ΒΆ

Name every public module of package, read from its source tree.

A name with an underscore-prefixed part is private, and so is everything below it: click_extra._utils, click_extra.sphinx._base and click_extra.__main__ are all skipped. A package is named by its __init__.py.

Return type:

list[str]

tests.test_docs_api.api_pages(package)[source]ΒΆ

Return the API pages of package, in the documentation tree.

Return type:

list[Path]

tests.test_docs_api.guide_pages()[source]ΒΆ

Return every page of the documentation tree that is not an API page.

Return type:

list[Path]

tests.test_docs_api.indexed_modules(pages)[source]ΒΆ

Collect each module an automodule directive indexes on pages.

A block carrying :no-index: registers no index entry, so it does not count.

Return type:

set[str]

tests.test_docs_api.test_package_is_collected(package)[source]ΒΆ

The globs feeding the check still find the modules and their API pages.

tests.test_docs_api.test_deprecation_shims_still_exist()[source]ΒΆ

An exemption goes in the same change that deletes its shim.

tests.test_docs_api.test_every_module_is_indexed_on_an_api_page(package)[source]ΒΆ

No public module is left to no page at all.

A failure names a module that no API page indexes. Run repomatic update-docs, which writes the page of the module and lists it in the toctree of its package.

tests.test_docs_api.test_no_guide_page_carries_an_autodoc_block()[source]ΒΆ

A guide page shows no API: neither the members of a module nor its class tree.

A failure names the guide page, the directive and the module of each block it carries. Move the block to the API page of the module, where an autoclasstree sits in a fence of its own above the automodule fence.

tests.test_docs_api.test_indexed_modules(tmp_path)[source]ΒΆ

A :no-index: block counts for nothing, wherever its option sits.