bazelbuild / bazelbuild/bazel-skylib

Document how to test a starlark function failure cases

Open
#580 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Starlark
Stars
444
Forks
202
PR merge metrics
No merged PRs in 30d

Description

Testing `fail()` scenarii in plain starlark functions using the `unittest` library is not supported out of the box and requires wrapping the function into a rule and creating an analysis test for it.

[This post](https://groups.google.com/g/bazel-discuss/c/GbaoLT4Ajac?pli=1) was very helpful in showing how to achieve that, and it would be great to add that somewhere in the docs (e.g. with a link to an example).

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked Bazel discussion and reviewing the existing documentation structure. Document how to test failure cases from plain Starlark functions using unittest, including wrapping the function in a rule and creating an analysis test; link to an example if appropriate.

Written by the indexing model from the issue text.

Assessment

Domain
documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.