Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions default_conf.py.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@

project = {PROJECT}
project_url = {PROJECT_URL}
version = "0.0.0"

extensions = ["score_sphinx_bundle"]
8 changes: 6 additions & 2 deletions src/tests/docs_bzl/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,15 @@ def built_output(package: str, filename: str) -> Path:
return root / "bazel-bin" / TEST_ROOT.relative_to(root) / package / filename


def load_needs(needs_json: Path) -> dict[str, object]:
def load_needs_json(needs_json: Path) -> dict[str, object]:
raw_data: object = json.loads(needs_json.read_text(encoding="utf-8"))
if not isinstance(raw_data, dict):
raise ValueError("needs.json must be an object")
data = cast("dict[str, object]", raw_data)
return cast("dict[str, object]", raw_data)


def load_needs(needs_json: Path) -> dict[str, object]:
data = load_needs_json(needs_json)
needs: dict[str, object] = {}
versions = data.get("versions", {})
if not isinstance(versions, dict):
Expand Down
21 changes: 9 additions & 12 deletions src/tests/docs_bzl/test_basic_docs.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,9 @@
# SPDX-License-Identifier: Apache-2.0
# *******************************************************************************

# *******************************************************************************
# Copyright (c) 2026 Contributors to the Eclipse Foundation
#
# See the NOTICE file(s) distributed with this work for additional
# information regarding copyright ownership.
#
# This program and the accompanying materials are made available under the
# terms of the Apache License Version 2.0 which is available at
# https://www.apache.org/licenses/LICENSE-2.0
# *******************************************************************************
"""Public docs() smoke scenario."""

from src.tests.docs_bzl.helpers import run_scenario
from src.tests.docs_bzl.helpers import load_needs_json, run_scenario


def test_basic_docs_builds_html():
Expand All @@ -35,4 +25,11 @@ def test_basic_docs_builds_html():


def test_basic_docs_builds_needs_without_conf_py():
run_scenario("build", "basic_docs", ":needs_json")
result = run_scenario("build", "basic_docs", ":needs_json")

# With no docs/conf.py the generated config is used; it must set a non-empty
# version so sphinx-needs writes a non-empty current_version into needs.json
# (an empty current_version makes the file unusable for external consumers).
assert result.artifacts is not None, f"expected artifacts: {result}"
data = load_needs_json(result.artifacts["needs.json"])
assert data["current_version"], "current_version must be non-empty"
Loading