tests.sphinx.test_sphinx_viewcode moduleΒΆ
Tests for the sphinx.ext.viewcode pages a build publishes.
- tests.sphinx.test_sphinx_viewcode.FRUITS_MODULE = 'import re\n\nSEED = re.compile(r"\\d+")\n"""Pattern of a seed count."""\n\n\ndef ripen(fruit):\n """Ripen a fruit."""\n'ΒΆ
A module documenting a constant whose value is an instance of
re.Pattern.viewcode looks for
SEEDin the module of that class,re, and finds nothing to link to there.
- tests.sphinx.test_sphinx_viewcode.PUBLISHED_PAGES = ['_modules/fruits.html', '_modules/index.html']ΒΆ
The module page of
fruits, and the index linking to it.
- tests.sphinx.test_sphinx_viewcode.write_project(srcdir)[source]ΒΆ
Write a project whose last document read documents
fruits.No later document purges the unused
reentry, so a serial read keeps it too.- Return type:
- tests.sphinx.test_sphinx_viewcode.module_pages(outdir)[source]ΒΆ
List the viewcode pages of a build, relative to its output directory.
- tests.sphinx.test_sphinx_viewcode.test_serial_read_publishes_linked_modules_only(tmp_path, monkeypatch)[source]ΒΆ
A serial read publishes no page for the module it read for nothing.
- tests.sphinx.test_sphinx_viewcode.test_parallel_read_publishes_the_pages_of_a_serial_one(tmp_path)[source]ΒΆ
A parallel read publishes the same pages as a serial one.
Its workers merge their entries after every purge has run, which is the case of sphinx-doc/sphinx#14675. The build runs in a process of its own: forking the test process, which runs other threads, can deadlock the workers.
- tests.sphinx.test_sphinx_viewcode.VINEYARD_MODULES = {'__init__.py': '', 'grape.py': 'class Grape:\n """A grape of the vineyard."""\n', 'harvest.py': 'from vineyard.grape import Grape\n\nMERLOT = Grape()\n"""A grape of the harvest."""\n'}ΒΆ
A package whose
harvestmodule documents an instance of agrapeclass.viewcode reads
MERLOTin the module of its class,vineyard.grape, and finds no definition of it there.
- tests.sphinx.test_sphinx_viewcode.test_backlinks_point_at_the_anchor_of_their_object(tmp_path, monkeypatch)[source]ΒΆ
A
[docs]link leads to its object, whatever signature viewcode read first.The page documents the instance before the class, so the instance creates the viewcode entry of
vineyard.grapeunder the module pathvineyard.harvest(sphinx-doc/sphinx#14815). One page is enough: a serial read purges an entry only between two pages.