Add collection methods to RunfilesSubject
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Domain
- testing
Research direction
Start at RunfilesSubject and inspect how its existing APIs represent Runfiles.file, empty_filenames, symlinks, and root_symlinks. Done means exposing the requested subject accessors plus paths() and path_map(), with collection matching and Bazel-compatible handling of overlapping file and symlink paths.
Written by the indexing model from the issue text.
Description
While asserting some runfiles, I needed to do something like:
target.runfiles().contains_at_least([
<ends with "/foo">,
<ends with "/foo.exe">
])
Unfortunately, there isn't a great way to do this.
At the least, I think these convenience methods need to be added:
.paths() -> CollectionSubject[str]: returns all the runfiles paths that are represented..path_map() -> DictSubject[str, File|None]: returns a mapping of path to File (or None, in the case of.empty_filenames). Unfortunately, this is, potentially, a lossy operation -- a symlink could have the same path as a regular file entry. So we would want to match Bazel's behavior for how it handles such cases as best we can.
And these two lower-level accessors need to be added:
.files() -> DepsetFileSubject: returns theRunfiles.filevalue as a subject.empty_filenames() -> CollectionSubject[str]: ReturnsRunfiles.empty_filenamesas a subject.symlinks() -> DepsetSubject[SymlinkEntry]: ReturnsRunfiles.symlinksas a subject.root_symlinks() -> DepsetSubject[SymlinKEntry]: ReturnsRunfiles.root_symlinksas a subject
I'm not sure how to best directly expose other methods because a runfiles object is a heterogenous collection -- Files, symlink entries, and str (empty file names). I think matching on the str paths is about the best we can do -- its the common denominator. For a more specific check, the other accessors can be used (e.g. to check that something is a symlink).
- Dominant language
- Starlark
- Stars
- 29
- Forks
- 11
- Avg merge
- 15h 15m
- Merged PRs (30d)
- 3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/rules_testing
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
bazelbuild/rules_testing#93 · 1 comment ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
bazelbuild/rules_testing#88 ·
-
enhancement
Difficulty 2/5 1-3 hours Newbie friendliness 52/100
bazelbuild/rules_testing#71 ·
-
enhancement
Difficulty 3/5 1-2 days Newbie friendliness 45/100
bazelbuild/rules_testing#65 ·
-
enhancement
Difficulty 4/5 3-5 days Newbie friendliness 30/100
bazelbuild/rules_testing#64 · 1 comment ·
All issues in bazelbuild/rules_testing
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
copse-dev/agent-pane#2953 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
calcite-components needs triage refactor
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
Esri/calcite-design-system#15203 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
danielmiessler/LifeOS#2218 ·
-
kind/cleanup
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
kubernetes-sigs/kueue#15947 ·