-
Notifications
You must be signed in to change notification settings - Fork 27
test: add docs() tests #665
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
17e8295
55f4395
2e977f4
20f6026
f0235a1
8e702ab
a699ff6
a41a20d
7741655
e3a31e6
9f74231
489dd9c
f872922
b290cba
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -109,5 +109,6 @@ filterwarnings = [ | |
| ] | ||
|
|
||
| pythonpath = [ | ||
| ".", | ||
| "src/extensions/", | ||
| ] | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| # Empty BUILD file ensures bazel will not see this directory when globbing |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| <!-- | ||
| ******************************************************************************* | ||
| Copyright (c) 2026 Contributors to the Eclipse Foundation | ||
|
|
||
| SPDX-License-Identifier: Apache-2.0 | ||
| ******************************************************************************* | ||
| --> | ||
|
|
||
| # `docs()` end-to-end tests | ||
|
|
||
| These tests run **outside** Bazel with pytest and drive the public `docs()` | ||
| macro through real `bazel run` / `bazel build` commands against small fixture | ||
| packages in this directory. They test exactly what a user runs. | ||
|
|
||
| Note that these tests run `bazel` commands, so they are slow. They need to be executed | ||
| sequentially. Use sparingly. | ||
|
|
||
| Run via: | ||
|
|
||
| pytest src/tests/docs_bzl -vv | ||
|
|
||
| *(no venv is required)* |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("//:docs.bzl", "docs") | ||
|
|
||
| docs( | ||
| source_dir = "docs", | ||
| test_sources = ["src/tests/docs_bzl/fixtures/basic"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| project = "Basic Test" | ||
| project_url = "https://github.com/eclipse-score/docs-as-code" | ||
| extensions = ["score_sphinx_bundle"] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,16 @@ | ||
| .. | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| Basic Test | ||
| ========== |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| load("//:docs.bzl", "docs") | ||
|
|
||
| # Mounts the same-repo producer's needs.json so the :need: link in index.rst can | ||
| # resolve. test_sources scopes the test-code-linker to this (test-less) package, | ||
| # avoiding the workspace-wide bazel-testlogs scan during the html build. | ||
| docs( | ||
| source_dir = "docs", | ||
| data = ["//src/tests/docs_bzl/fixtures/external_needs/producer:needs_json"], | ||
| test_sources = ["src/tests/docs_bzl/fixtures/external_needs/consumer"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| # ******************************************************************************* | ||
|
MaximilianSoerenPollak marked this conversation as resolved.
|
||
| # 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 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| import os | ||
|
|
||
| project = "External Needs Consumer" | ||
| project_url = "https://example.invalid/external-needs-consumer" | ||
| extensions = ["score_sphinx_bundle"] | ||
|
|
||
| # FIXME: | ||
| # sphinx-needs refuses to add an external need whose type is not registered in | ||
| # this project's needs_types, so the consumer must declare the producer's | ||
| # `test_req` type. score_metamodel's own checks skip external needs, so the | ||
| # id/parts rules never run here. Loaded via the score_metamodel_yaml config | ||
| # value because docs(metamodel=...) does not reach the build target. | ||
|
Comment on lines
+20
to
+25
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You could just add the test_req to the config here no? well okay not that simple, if I look at how it is done in the rst tests:
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is just temp, we need to fix the underlying issue in docs(). Then this can be removed completely. |
||
| score_metamodel_yaml = os.path.join( | ||
| os.path.dirname(os.path.abspath(__file__)), "metamodel.yaml" | ||
| ) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| .. | ||
| # ******************************************************************************* | ||
| # 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 | ||
| # | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # ******************************************************************************* | ||
|
|
||
| External Needs Consumer | ||
| ======================= | ||
|
|
||
| This document links to a need defined in the producer package: | ||
| :need:`test_req__producer__demo`. |
Uh oh!
There was an error while loading. Please reload this page.