Skip to content

Commit

Permalink
add sphinxcontrib.jquery
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisjsewell committed Nov 6, 2023
1 parent 4e1617f commit a30f91b
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ requests-file = "^1.5.1" # external links
requests = "^2.25.1" # external_links
jsonschema = ">=3.2.0" # needsimport schema validation
sphinx-data-viewer = "^0.1.1" # needservice debug output
sphinxcontrib-jquery = "^4" # needed for datatables in sphinx>=6

# [project.optional-dependencies.test]
pytest = { version = "^7", optional = true }
Expand Down
1 change: 1 addition & 0 deletions sphinx_needs/needs.py
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ def setup(app: Sphinx) -> Dict[str, Any]:
log.debug("Starting setup of Sphinx-Needs")
log.debug("Load Sphinx-Data-Viewer for Sphinx-Needs")
app.setup_extension("sphinx_data_viewer")
app.setup_extension("sphinxcontrib.jquery")

app.add_builder(NeedsBuilder)
app.add_builder(NeedumlsBuilder)
Expand Down
14 changes: 11 additions & 3 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,12 @@ def test_js(self) -> Dict[str, Any]:
}


def pytest_addoption(parser):
parser.addoption("--sn-build-dir", action="store", default=None, help="Base directory for sphinx-needs builds")


@pytest.fixture(scope="session")
def sphinx_test_tempdir() -> path:
def sphinx_test_tempdir(request) -> path:
"""
Fixture to provide a temporary directory for Sphinx testing.
Expand All @@ -188,7 +192,10 @@ def sphinx_test_tempdir() -> path:
"""
# We create a temp-folder on our own, as the util-functions from sphinx and pytest make troubles.
# It seems like they reuse certain-temp names
sphinx_test_tempdir = path(tempfile.gettempdir()).joinpath("sn_test_build_data")

temp_base = os.path.abspath(request.config.getoption("--sn-build-dir") or tempfile.gettempdir())

sphinx_test_tempdir = path(temp_base).joinpath("sn_test_build_data")
utils_dir = sphinx_test_tempdir.joinpath("utils")

# if not (sphinx_test_tempdir.exists() and sphinx_test_tempdir.isdir()):
Expand Down Expand Up @@ -261,7 +268,8 @@ def test_app(make_app, sphinx_test_tempdir, request):
yield app

# Clean up the srcdir of each Sphinx app after the test function has executed
shutil.rmtree(parent_path, ignore_errors=True)
if request.config.getoption("--sn-build-dir") is None:
shutil.rmtree(parent_path, ignore_errors=True)


class DoctreeSnapshotExtension(SingleFileSnapshotExtension):
Expand Down

0 comments on commit a30f91b

Please sign in to comment.