tests.sphinx.test_sphinx_parallel moduleΒΆ
Tests for the fixes that make a parallel read index what a serial read indexes.
- tests.sphinx.test_sphinx_parallel.broken_backlinks(outdir)[source]ΒΆ
List the
[docs]links of the viewcode pages that reach no anchor.
- tests.sphinx.test_sphinx_parallel.GRAPE = 'vineyard.grape.Grape'ΒΆ
The name of a class under the path of the module that defines it.
- tests.sphinx.test_sphinx_parallel.GRAPE_DEFINITION = ('grape', 'vineyard.grape.Grape', 'class', False)ΒΆ
The entry that the page of the module registers for the class.
- tests.sphinx.test_sphinx_parallel.GRAPE_ALIAS = ('vineyard', 'vineyard.Grape', 'class', True)ΒΆ
The entry that a page re-exporting the class registers through
:canonical:.
- tests.sphinx.test_sphinx_parallel.merge_worker(env, docnames, objects)[source]ΒΆ
Merge a worker that read
docnamesand holdsobjects, as Sphinx does.Runs the merge of
PythonDomain, then the hook, which is the orderBuildEnvironment.merge_info_fromfollows for each worker of a parallel read.- Return type:
- tests.sphinx.test_sphinx_parallel.test_parallel_merge_keeps_the_definition_over_an_alias(definition_first)[source]ΒΆ
A definition stays indexed, whichever worker merges first.
PythonDomain.merge_domaindatacopies the entries of each worker over the ones in place, so an alias merged after the definition replaces it. A serial read keeps the definition.
- tests.sphinx.test_sphinx_parallel.test_a_read_forgets_the_definitions_of_the_last_one()[source]ΒΆ
A definition merged in one build never comes back in the next one.
- tests.sphinx.test_sphinx_parallel.TERROIR_MODULES = {'__init__.py': 'from terroir.grape import Grape, Vine\n\n__all__ = ["Grape", "Vine"]\n', 'cellar.py': '"""Wine that takes its time."""\n\nimport time\n\ntime.sleep(1)\n', 'grape.py': 'class Grape:\n """A grape of the terroir."""\n\n\nclass Vine:\n """A vine of the terroir."""\n\n\ndef press():\n """Press the grapes."""\n'}ΒΆ
A package re-exporting both classes of its
grapemodule, but notpress.The page of the package also documents
cellar, whose import takes a second, so the worker that reads that page merges after the worker that readsgrape.
- tests.sphinx.test_sphinx_parallel.test_parallel_read_keeps_the_backlinks_of_a_serial_one(tmp_path)[source]ΒΆ
A parallel read points each
[docs]link at an anchor, as a serial read does.The page of the package documents
GrapeandVinewith a:canonical:alias toterroir.grape. Merged after the page ofgrape, those aliases replace its definitions, unless the extension puts them back. The root path then indexes more objects ofgrapethan its own path does, and the link ofpress, which the package does not re-export, leads under the root path.
- tests.sphinx.test_sphinx_parallel.BASKET_MODULE = 'from __future__ import annotations\n\nTYPE_CHECKING = False\nif TYPE_CHECKING:\n from typing import TypeAlias\n\n Fruits: TypeAlias = "tuple[str, ...]"\n """Fruits a basket holds."""\n\n\nclass Basket:\n """A basket of fruits."""\n\n def __init__(self, *fruits: str) -> None:\n """Fill the basket."""\n self.fruits: tuple[str, ...] = fruits\n'ΒΆ
A module annotating two names that only its source holds.
Fruitssits in aTYPE_CHECKINGblock, andBasket.fruitsin__init__.
- tests.sphinx.test_sphinx_parallel.test_a_page_read_first_lists_its_annotated_members(tmp_path, monkeypatch)[source]ΒΆ
A page lists the names its module annotates, whatever autodoc read before.
autodoc copies the annotations of the source into the module and its classes only when it documents an attribute of the module, then lists each annotated name as a member. Without the copy made in advance, a page read before any such attribute, like the first page of a parallel worker, lists neither name.
- tests.sphinx.test_sphinx_parallel.CRATE_MODULE = 'from typing import TypedDict\n\n\nclass _Fields(TypedDict, total=False):\n weight: int\n """How heavy the crate is."""\n\n\nclass Crate(_Fields, total=False):\n """A crate of fruits."""\n\n color: str\n """The color of the crate."""\n'ΒΆ
A module whose
TypedDicttakes a field from a private base.Without
from __future__ import annotations, Python 3.14 and later evaluate the annotations of a class lazily, through its__annotate__.
- tests.sphinx.test_sphinx_parallel.test_copied_annotations_keep_the_fields_of_a_typeddict_base(tmp_path, monkeypatch)[source]ΒΆ
A
TypedDictstill lists the fields of its base once its module is annotated.Assigning a new
__annotations__to the base, rather than filling the one in place, clears its__annotate__from Python 3.14 on, andCratethen reads its own field alone.