bazelbuild / bazelbuild/bazel-skylib
Show line number of the failing assert in unittests
- Dominant language
- Starlark
- Stars
- 444
- Forks
- 202
- PR merge metrics
- No merged PRs in 30d
Description
Hi dear Skylib maintainers,
right now we print the assertion error with the location `.../external/bazel_skylib/lib/unittest.bzl:351:10:`. It would be much more useful if we either printed the entire stack trace, or show the location of the callsite.
An argument could be made that there should be just one assertion per unit test, in that scenario this is not a problem. However there is so much boilerplate involved with adding a unit test that this is not practical to have one assertion per test. And even Bazel's internal `BuildViewTestCase` tests have multiple assertions per test.
Thank you!
Contributor guide
Research direction
Start in external/bazel_skylib/lib/unittest.bzl around the reported assertion location, 351:10, and trace how assertion failures are formatted and where their location is selected. Compare the requested alternatives—printing the stack trace or showing the callsite—and define completion as reporting the failing assert's useful source location.
Written by the indexing model from the issue text.
Assessment
- Domain
- testing
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100