tests.sphinx.test_sphinx_click_config moduleΒΆ
Tests for the click:config Sphinx directive.
- class tests.sphinx.test_sphinx_click_config.BasketConfig(apples=3)[source]ΒΆ
Bases:
objectNested sub-table exercising the dotted-key expansion.
- class tests.sphinx.test_sphinx_click_config.MarketConfig(city='Lisbon', stalls=<factory>, basket=BasketConfig())[source]ΒΆ
Bases:
objectToy schema reused across tests.
Defined at module level (not inside a
click:sourceblock) soinspect.getsourcecan recover the attribute docstrings.- city: str = 'Lisbon'ΒΆ
City where the market is held.
The market moves to the main square during summer, and to the covered hall the rest of the year.
- basket: BasketConfigΒΆ
Parent table docstring, never rendered: only leaves get sections.
- tests.sphinx.test_sphinx_click_config.MARKET_SEED = '```{click:source}\n:hide-source:\nfrom tests.sphinx.test_sphinx_click_config import market\n```\n'ΒΆ
Seed block importing the module-level CLI into the runner namespace.
- class tests.sphinx.test_sphinx_click_config.PastryConfig(creme_brulee='vanilla|caramel', five_spice=5)[source]ΒΆ
Bases:
objectSchema whose keys need slugging and whose default needs escaping.
- tests.sphinx.test_sphinx_click_config.PASTRY_CONFIG = '\n```{click:config} PastryConfig\nfrom tests.sphinx.test_sphinx_click_config import PastryConfig\n```\n'ΒΆ
Directive documenting
PastryConfig.
- tests.sphinx.test_sphinx_click_config.test_click_config_default_and_toml_literal(value, default, literal)[source]ΒΆ
A default renders in the table, and as the literal of its TOML example.
- tests.sphinx.test_sphinx_click_config.test_click_config_renders_table_and_sections(sphinx_app_myst)[source]ΒΆ
The directive expands into a summary table + one section per option.
- tests.sphinx.test_sphinx_click_config.test_click_config_links_every_option_to_its_section(sphinx_app_myst)[source]ΒΆ
Each table link lands on the id docutils gives the optionβs heading.
make_idwrites the accented letters ofcrème-brûléeas their ASCII base, and drops the leading digit of5-spice.
- tests.sphinx.test_sphinx_click_config.test_click_config_keeps_a_piped_default_in_its_cell(sphinx_app_myst)[source]ΒΆ
A pipe in a default value stays text, rather than splitting its row.
- tests.sphinx.test_sphinx_click_config.test_click_config_toml_examples(sphinx_app_myst)[source]ΒΆ
Each option gets a TOML example pinned to its default value.
The section header defaults to
tool.{cli-name}, matching how click-extra and its downstream CLIs read their section frompyproject.toml.
- tests.sphinx.test_sphinx_click_config.test_click_config_section_override_and_suppress(sphinx_app_myst)[source]ΒΆ
:section:overrides the example header; an empty value drops it.
- tests.sphinx.test_sphinx_click_config.test_click_config_bare_schema_argument(sphinx_app_myst)[source]ΒΆ
A dataclass argument documents the schema without any CLI wired.
Without a CLI there is no name to derive the section header from, so the examples render bare assignments.
- tests.sphinx.test_sphinx_click_config.test_click_config_no_table_and_no_examples(sphinx_app_myst)[source]ΒΆ
:no-table:and:no-examples:drop their blocks.
- tests.sphinx.test_sphinx_click_config.test_click_config_exec_defined_schema_lacks_docstrings(sphinx_app_myst)[source]ΒΆ
A schema defined in an execβd block renders without descriptions.
- tests.sphinx.test_sphinx_click_config.test_click_config_errors_without_schema(sphinx_app_myst)[source]ΒΆ
A CLI with no
config_schemaraises a clear directive error.
- tests.sphinx.test_sphinx_click_config.test_click_config_errors_on_non_schema(sphinx_app_myst)[source]ΒΆ
Resolving the argument to a non-dataclass raises a clear error.
- tests.sphinx.test_sphinx_click_config.test_click_config_errors_on_unknown_name(sphinx_app_myst)[source]ΒΆ
An expression that canβt be evaluated raises a clear directive error.
- tests.sphinx.test_sphinx_click_config.test_click_config_errors_in_rst(sphinx_app_rst)[source]ΒΆ
click:configraises a clear error when used in an rST document.
- tests.sphinx.test_sphinx_click_config.test_click_config_heading_offset_adapts_to_surrounding_section(sphinx_app_myst)[source]ΒΆ
Nested inside an
h2section, option headings render ath3.
- class tests.sphinx.test_sphinx_click_config.OrchardConfig(trees=12, rows=4, seasons=<factory>)[source]ΒΆ
Bases:
objectSchema whose docstrings make Markdown headings, or look like they do.
- tests.sphinx.test_sphinx_click_config.test_click_config_warns_on_docstring_heading(sphinx_app_myst)[source]ΒΆ
Each heading in an option docstring is reported at its docstring line.
The lone
=makes a setext heading of the paragraph above it,# Pruningis an ATX heading, and the lines of a code block are no heading at all.