-
Notifications
You must be signed in to change notification settings - Fork 9
Open
Labels
enhancementNew feature or requestNew feature or request
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).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request