tests.sphinx.test_sphinx moduleΒΆ

Fixtures and utilities for Sphinx testing.

tests.sphinx.test_sphinx.test_import_without_myst_parser()[source]ΒΆ

The extension imports in a project that installs no myst-parser.

Sphinx does not depend on myst-parser, so a project that installs Sphinx without the sphinx extra has none. A hard import of it in click_extra.sphinx breaks such a project outright.

tests.sphinx.test_sphinx.imports_sphinx_package(node)[source]ΒΆ

Whether an import statement reaches click_extra.sphinx or a module of it.

Return type:

bool

tests.sphinx.test_sphinx.is_sphinx_guard(call)[source]ΒΆ

Whether the call is pytest.importorskip("sphinx", ...).

Return type:

bool

tests.sphinx.test_sphinx.unguarded_sphinx_imports(tree)[source]ΒΆ

Lines importing click_extra.sphinx that no importorskip("sphinx") precedes.

A guard covers the rest of the function it is called in, or the whole module when called at its top level.

Return type:

list[int]

tests.sphinx.test_sphinx.test_imports_outside_this_tree_skip_without_sphinx()[source]ΒΆ

Outside tests/sphinx/, a test skips itself before importing the extension.

The collect_ignore_glob of this tree skips it on a builder shipping no Sphinx, and covers no test outside it. Such a test has to call pytest.importorskip("sphinx") before it imports click_extra.sphinx, or it fails on that builder instead of skipping.

tests.sphinx.test_sphinx.test_sphinx_extension_setup(sphinx_app)[source]ΒΆ

Test that the Sphinx extension is properly loaded.

tests.sphinx.test_sphinx.test_resolve_any_xref(sphinx_app)[source]ΒΆ

Test that resolve_any_xref is implemented and returns an empty list.