def rootdir():
    """The directory in which to search for testroots.

    This is used by any test using the pytest.mark.sphinx decorator. For a
    `testroot` specified in the decorator, the rootdir will be
    "./test_extension/roots/test-<testroot>".

    The rootdir must contain a conf.py file. All of the rootdir's content will
    be copied to a temporary folder, and the Sphinx builder will be invoked
    inside that folder.
    """
    return sphinx_path(str(Path(__file__).with_suffix('') / 'roots'))
示例#2
0
def test_quickstart(tmp_path: Path, make_app):
    """Test the quickstart CLI builds a valid sphinx project."""
    path = tmp_path / "project"
    quickstart([str(path)])
    assert {p.name
            for p in path.iterdir()} == {
                ".gitignore",
                "conf.py",
                "index.md",
                "notebook1.ipynb",
                "notebook2.md",
            }
    app = make_app(srcdir=sphinx_path(str(path)), buildername="html")
    app.build()
    assert app._warning.getvalue().strip() == ""
    assert (path / "_build/html/index.html").exists()
示例#3
0
 def _func(src_folder, **kwargs):
     shutil.copytree(SRC_DIR / src_folder, tmp_path / src_folder)
     app = make_app(srcdir=sphinx_path(
         os.path.abspath((tmp_path / src_folder))),
                    **kwargs)
     return SphinxBuild(app, tmp_path / src_folder)
 def _func(src_folder, **kwargs):
     copytree(path_tests / "sites" / src_folder, tmp_path / src_folder)
     app = make_app(srcdir=sphinx_path(
         os.path.abspath((tmp_path / src_folder))),
                    **kwargs)
     return SphinxBuild(app, tmp_path / src_folder)
 def _func(src_path: Path, **kwargs) -> SphinxBuild:
     app = make_app(srcdir=sphinx_path(os.path.abspath(str(src_path))),
                    **kwargs)
     return SphinxBuild(app, src_path)