feat(docs_and_test): Bazel macro chaining tests/coverage with docs build - #759
Draft
antonkri wants to merge 2 commits into
Draft
feat(docs_and_test): Bazel macro chaining tests/coverage with docs build#759antonkri wants to merge 2 commits into
antonkri wants to merge 2 commits into
Conversation
New docs_and_test macro generates two py_binary targets that run
'bazel test' (or 'bazel coverage --combined_report=lcov' when
coverage=True) followed by 'bazel run //:docs' resp. '//:live_preview'
in a single command:
load('@score_docs_as_code//:bzl/docs_and_test.bzl', 'docs_and_test')
docs_and_test(
name = 'module_verification_report',
test_targets = ['//score/...'],
)
Consumers get //:<name> and //:<name>_preview without any local
Python driver. Extra Bazel flags forward via '--test-flag=…'. Ctrl+C
in the driver propagates cleanly as exit 130.
Ships the driver via exports_files so external py_binary(srcs=…)
can reference it.
…patterns Negative Bazel target patterns (e.g. '-//foo:bar') passed via test_targets were mistaken for CLI flags by 'bazel test'/'bazel coverage'. Insert '--' as a separator before the targets so they are always parsed as target patterns. (Split out of #730, which also fixed an unrelated zero-coverage-row rendering bug in the score_module_verification_report extension.)
Contributor
License Check Results🚀 The license check job ran with the Bazel command: bazel run --lockfile_mode=error //src:license-checkStatus: Click to expand output |
antonkri
added a commit
that referenced
this pull request
Aug 26, 2026
Removes bzl/docs_and_test.bzl, bzl/run_docs_and_test.py and the BUILD exports_files entry for the driver script, along with the 'Running tests and docs together: docs_and_test' documentation section, since this PR should only cover the score_module_verification_report Sphinx extension. The docs_and_test macro (including the -- separator fix for negative Bazel target patterns) now lives in #759.
Contributor
|
Documentation preview for this pull request is available at: |
MaximilianSoerenPollak
pushed a commit
that referenced
this pull request
Aug 27, 2026
Removes bzl/docs_and_test.bzl, bzl/run_docs_and_test.py and the BUILD exports_files entry for the driver script, along with the 'Running tests and docs together: docs_and_test' documentation section, since this PR should only cover the score_module_verification_report Sphinx extension. The docs_and_test macro (including the -- separator fix for negative Bazel target patterns) now lives in #759.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split out of #730, which grew to cover two independent concerns. This PR contains only the
docs_and_testBazel macro:bzl/docs_and_test.bzl: macro generating<name>/<name>_previewpy_binarytargets that runbazel test/bazel coverageon a set of test targets, then invoke a docs (or live-preview) target — since Bazel has no native way to make a build target depend on test execution.bzl/run_docs_and_test.py: the Python driver invoked by those targets, including a fix so negative Bazel target patterns (e.g.-//foo:bar) are correctly separated with--instead of being mistaken for CLI flags.BUILD: exportsbzl/run_docs_and_test.pyso it can be used as apy_binarysrcs/mainfile by consumers.The
score_module_verification_reportSphinx extension changes remain in #730 and are independent of this macro (the directive works standalone;docs_and_testis just a convenience wrapper so a report reflects a fresh test run).