MCPcopy
hub / github.com/sphinx-doc/sphinx / test_instantiation

Function test_instantiation

tests/test_application.py:26–49  ·  view source on GitHub ↗
(
    tmp_path_factory: pytest.TempPathFactory,
    rootdir: str | os.PathLike[str] | None,
)

Source from the content-addressed store, hash-verified

24
25
26def test_instantiation(
27 tmp_path_factory: pytest.TempPathFactory,
28 rootdir: str | os.PathLike[str] | None,
29) -> None:
30 # Given
31 src_dir = tmp_path_factory.getbasetemp() / 'root'
32
33 # special support for sphinx/tests
34 if rootdir and not src_dir.exists():
35 shutil.copytree(Path(str(rootdir)) / 'test-root', src_dir)
36
37 saved_path = sys.path.copy()
38
39 # When
40 app_ = SphinxTestApp(
41 srcdir=src_dir,
42 status=StringIO(),
43 warning=StringIO(),
44 )
45 sys.path[:] = saved_path
46 app_.cleanup()
47
48 # Then
49 assert isinstance(app_, sphinx.application.Sphinx)
50
51
52@pytest.mark.sphinx('html', testroot='root')

Callers

nothing calls this directly

Calls 3

cleanupMethod · 0.95
SphinxTestAppClass · 0.90
copyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…