diff --git a/src/rst_budoux/sphinx.py b/src/rst_budoux/sphinx.py index 80844d0..25555fa 100644 --- a/src/rst_budoux/sphinx.py +++ b/src/rst_budoux/sphinx.py @@ -1 +1,14 @@ """Implementation as Sphinx-extension.""" + +from sphinx.application import Sphinx + +from . import __version__ + + +def setup(app: Sphinx): # noqa: D103 + return { + "version": __version__, + "env_version": 1, + "parallel_read_safe": True, + "parallel_write_safe": True, + } diff --git a/tests/conftest.py b/tests/conftest.py new file mode 100644 index 0000000..0592a9e --- /dev/null +++ b/tests/conftest.py @@ -0,0 +1,11 @@ +"""Configuration for pytest.""" + +import pytest +from sphinx.testing.path import path + +pytest_plugins = "sphinx.testing.fixtures" + + +@pytest.fixture(scope="session") +def rootdir() -> path: # noqa: D103 + return (path(__file__).parent / "doc-targets").abspath() diff --git a/tests/doc-targets/test-root/conf.py b/tests/doc-targets/test-root/conf.py new file mode 100644 index 0000000..44965fb --- /dev/null +++ b/tests/doc-targets/test-root/conf.py @@ -0,0 +1,5 @@ +# noqa: D100 + +extensions = [ + "rst_budoux.sphinx", +] diff --git a/tests/doc-targets/test-root/index.rst b/tests/doc-targets/test-root/index.rst new file mode 100644 index 0000000..8548719 --- /dev/null +++ b/tests/doc-targets/test-root/index.rst @@ -0,0 +1,3 @@ +Test doc for rst-budoux +======================= + diff --git a/tests/test_sphinx.py b/tests/test_sphinx.py new file mode 100644 index 0000000..8a9baad --- /dev/null +++ b/tests/test_sphinx.py @@ -0,0 +1,10 @@ +"""Standard tests as Sphinx-extension.""" + +import pytest +from sphinx.testing.util import SphinxTestApp + + +@pytest.mark.sphinx("html") +def test__it(app: SphinxTestApp): + """Test that it passes with rst-budoux extension.""" + app.build()