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 thesphinxextra has none. A hard import of it inclick_extra.sphinxbreaks such a project outright.
- tests.sphinx.test_sphinx.imports_sphinx_package(node)[source]ΒΆ
Whether an import statement reaches
click_extra.sphinxor a module of it.- Return type:
- tests.sphinx.test_sphinx.is_sphinx_guard(call)[source]ΒΆ
Whether the call is
pytest.importorskip("sphinx", ...).- Return type:
- tests.sphinx.test_sphinx.unguarded_sphinx_imports(tree)[source]ΒΆ
Lines importing
click_extra.sphinxthat noimportorskip("sphinx")precedes.A guard covers the rest of the function it is called in, or the whole module when called at its top level.
- 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_globof this tree skips it on a builder shipping no Sphinx, and covers no test outside it. Such a test has to callpytest.importorskip("sphinx")before it importsclick_extra.sphinx, or it fails on that builder instead of skipping.