module documentation

Sphinx test fixtures for pytest

Unknown Field: copyright
Copyright 2007-2022 by the Sphinx team, see AUTHORS.
Unknown Field: license
BSD, see LICENSE for details.
Constant DEFAULT​_ENABLED​_MARKERS Undocumented
Class ​Shared​Result Undocumented
Function ​_shared​_result​_cache Undocumented
Function app Provides the 'sphinx.application.Sphinx' object
Function app​_params Parameters that are specified by 'pytest.mark.sphinx' for sphinx.application.Sphinx initialization
Function if​_graphviz​_found The test will be skipped when using 'if_graphviz_found' fixture and graphviz dot command is not found.
Function make​_app Provides make_app function to initialize SphinxTestApp instance. if you want to initialize 'app' in your test function. please use this instead of using SphinxTestApp class directory.
Function pytest​_configure Register custom markers
Function rollback​_sysmodules Rollback sys.modules to its value before testing to unload modules during tests.
Function rootdir Undocumented
Function shared​_result Undocumented
Function sphinx​_test​_tempdir Temporary directory wrapped with path class.
Function status Back-compatibility for testing with previous @with_app decorator
Function tempdir Temporary directory wrapped with path class. This fixture is for back-compatibility with old test implementation.
Function test​_params Test parameters that are specified by 'pytest.mark.test_params'
Function warning Back-compatibility for testing with previous @with_app decorator
DEFAULT_ENABLED_MARKERS: list[str] =

Undocumented

Value
['sphinx(builder, testroot=None, freshenv=False, confoverrides=None, tags=None, 
docutilsconf=None, parallel=0): arguments to initialize the sphinx test applicat
ion.',
 'test_params(shared_result=...): test parameters.']
@pytest.fixture(scope='module', autouse=True)
def _shared_result_cache():

Undocumented

@pytest.fixture(scope='function')
def app(test_params, app_params, make_app, shared_result):
Provides the 'sphinx.application.Sphinx' object
Parameters
test​_params:DictUndocumented
app​_params:Tuple[Dict, Dict]Undocumented
make​_app:CallableUndocumented
shared​_result:SharedResultUndocumented
Returns
Generator[SphinxTestApp, None, None]Undocumented
@pytest.fixture
def app_params(request, test_params, shared_result, sphinx_test_tempdir, rootdir):
Parameters that are specified by 'pytest.mark.sphinx' for sphinx.application.Sphinx initialization
Parameters
request:AnyUndocumented
test​_params:DictUndocumented
shared​_result:SharedResultUndocumented
sphinx​_test​_tempdir:strUndocumented
rootdir:strUndocumented
Returns
Tuple[Dict, Dict]Undocumented
@pytest.fixture
def if_graphviz_found(app):
The test will be skipped when using 'if_graphviz_found' fixture and graphviz dot command is not found.
Parameters
app:SphinxTestAppUndocumented
@pytest.fixture()
def make_app(test_params, monkeypatch):
Provides make_app function to initialize SphinxTestApp instance. if you want to initialize 'app' in your test function. please use this instead of using SphinxTestApp class directory.
Parameters
test​_params:DictUndocumented
monkeypatch:AnyUndocumented
Returns
Generator[Callable, None, None]Undocumented
def pytest_configure(config):
Register custom markers
@pytest.fixture
def rollback_sysmodules():

Rollback sys.modules to its value before testing to unload modules during tests.

For example, used in test_ext_autosummary.py to permit unloading the target module to clear its cache.

@pytest.fixture(scope='session')
def rootdir():

Undocumented

Returns
strUndocumented
@pytest.fixture
def shared_result():

Undocumented

Returns
SharedResultUndocumented
@pytest.fixture(scope='session')
def sphinx_test_tempdir(tmpdir_factory):
Temporary directory wrapped with path class.
Parameters
tmpdir​_factory:AnyUndocumented
Returns
util.pathUndocumented
@pytest.fixture(scope='function')
def status(app):
Back-compatibility for testing with previous @with_app decorator
Parameters
app:SphinxTestAppUndocumented
Returns
StringIOUndocumented
@pytest.fixture
def tempdir(tmpdir):
Temporary directory wrapped with path class. This fixture is for back-compatibility with old test implementation.
Parameters
tmpdir:strUndocumented
Returns
util.pathUndocumented
@pytest.fixture
def test_params(request):
Test parameters that are specified by 'pytest.mark.test_params'
Parameters
request:AnyUndocumented
​Union[str] shared_resultIf the value is provided, app._status and app._warning objects will be shared in the parametrized test functions and/or test functions that have same 'shared_result' value. NOTE: You can not specify both shared_result and srcdir.
Returns
DictUndocumented
@pytest.fixture(scope='function')
def warning(app):
Back-compatibility for testing with previous @with_app decorator
Parameters
app:SphinxTestAppUndocumented
Returns
StringIOUndocumented