I find it more ergonomic to add notes or a description about a test to a `doc` attribute, similar to other rules, vs a comment block above it or in the `impl` function docstring. Hopefully this can improve the readability of test rules.
This is a relatively simple addition to unittest that statically creates rules
that either explicitly fail or not depending on if the test case is valid during
LOADING phase of bazel. The test conditions are evaluated entirely in loading
phase, but if we want an actual test to fail rather than just `fail()` killing
the build, we can use this to assert state and report test failures.
* Enable unittest.suite to accept partial calls of rules
This permits using `unittest.suite` with test rules that have nondefault
attributes, while retaining compatibility with current usage.
For instance, this permits setting a `timeout` on each test in a
`unittest.suite`. Previously, all tests in a `unittest.suite` would
have the default timeout, with no good way to alter this. This
made it hard to eliminate all the warnings produced from using the
`--test_verbose_timeout_warnings` bazel option.
While timeouts were the motivation, the solution here is not specific
to timeouts. It will permit arbitrary additional arguments to the test
rules in a `unittest.suite`.
Fixes #98
* Respond to review feedback.
* Document a breaking change in bazel that this code needs to be aware of.
Without this change, evaluating bzl with strict dependencies results in an error.
[`load(":new_sets.bzl", _sets = "sets")`](560d7b2359/lib/sets.bzl (L17)) results in `No such file or directory: 'third_party/bazel_skylib/lib/new_sets.bzl`
Specifically:
selects.config_setting_group(
name = "always_true",
match_any = ["//conditions:default"],
)
and
selects.config_setting_group(
name = "always_true",
match_all = ["//conditions:default"],
)
These should, as expected, always evaluate to True.
Their implementation had a bug that failed the build outright.
The output directories for the target under test may differ when the target is under a config transition (config_settings is passed to analysistest.make). Since analysis tests may assert about the command-line of generated actions, and those command-lines may contain paths to output files, this is useful information to expose.
* Add sets.is_set() to test whether an arbitrary object is a set.
Since using sets requires special API, it can be useful to determine
whether an object is a set so special handling can be used.
For example, if a method wants to be able to take a list or a set.
* add empty CHANGELOG.md to try to reuse bazel release.sh
* checkpoint a new distribution method
* Update CHANGELOG.
* checkpoint relnew
* get the tarball working
* fix visibilyt
* whitespace
* punctuation typos
* buildify
* linty fresh
- Update to newer version of stardoc.
- Make lib/selects.bzl stardoc compatible. There must be a block description before Args:
Docs now generate with
bazel build --incompatible_remap_main_repo docs:*
See https://github.com/bazelbuild/bazel/issues/7130 for reasons.
* Make sets.bzl point to new_sets.bzl instead of old_sets.bzl
new_sets.bzl and old_sets.bzl should be removed in the following skylib release.
Fixes #155.
* update and rename test suites
In this commit:
- change unittest.bzl to declare a named output
file instead of relying on the deprecated [1]
default output name (ctx.outputs.executable).
- define a new toolchain_type and toolchain rules
for cmd.exe and for Bash (basically Windows and
non-Windows)
- register the new toolchains in workspace.bzl
- let unittest.make-created test rules require the
new toolchain_type
- write the test output script as a Windows batch
script or as a Shell script, depending on the
selected toolchain
This PR enables the Bazel team to break the Bash
dependency (for test execution) on Windows, and
can run Starlark unittests with the new,
Windows-native test wrapper (still under
development).
See https://github.com/bazelbuild/bazel/issues/5508
In future Bazel releases ctx.file_action will be removed.
ctx.action.write should be used instead.
With this change tests pass even if --incompatible_new_actions_api
is used.
Bazel issue:
https://github.com/bazelbuild/bazel/issues/5825
The fail() and print() primitives take strings without newlines in them
because the formatted output will already contain newlines. Therefore,
remove them, which have been annoying me to no end when using rules_go
with a HEAD-built Bazel binary.
While doing this, also switch to using .format() consistently for all
strings, merge two related debug messages into the same print() call,
and fix grammar.
Most notably, this renames/moves a few important identifiers:
//:skylark_library.bzl -> //:bzl_library.bzl
skylark_library -> bzl_library
SkylarkLibraryInfo -> StarlarkLibraryInfo