# RunfilesSubject {.starlark-object} ## RunfilesSubject.check_workspace_prefix {.starlark-signature} RunfilesSubject.check_workspace_prefix([path](#runfilessubject_check_workspace_prefix_path)) {#runfilessubject_check_workspace_prefix_parameters} **PARAMETERS** [¶](#runfilessubject_check_workspace_prefix_parameters){.headerlink} :[path[¶](#runfilessubject_check_workspace_prefix_path){.headerlink}]{.span}: []{#runfilessubject_check_workspace_prefix_path} _undocumented_ {.starlark-object} ## RunfilesSubject.contains {.starlark-signature} RunfilesSubject.contains([expected](#runfilessubject_contains_expected)) Assert that the runfiles contains the provided path. Method: RunfilesSubject.contains {#runfilessubject_contains_parameters} **PARAMETERS** [¶](#runfilessubject_contains_parameters){.headerlink} :[expected[¶](#runfilessubject_contains_expected){.headerlink}]{.span}: []{#runfilessubject_contains_expected} ([`str`]) the path to check is present. This will be formatted using `ExpectMeta.format_str` and its current contextual keywords. Note that paths are runfiles-root relative (i.e. you likely need to include the workspace name.) {.starlark-object} ## RunfilesSubject.contains_at_least {.starlark-signature} RunfilesSubject.contains_at_least([paths](#runfilessubject_contains_at_least_paths)) Assert that the runfiles contains at least all of the provided paths. Method: RunfilesSubject.contains_at_least All the paths must exist, but extra paths are allowed. Order is not checked. Multiplicity is respected. {#runfilessubject_contains_at_least_parameters} **PARAMETERS** [¶](#runfilessubject_contains_at_least_parameters){.headerlink} :[paths[¶](#runfilessubject_contains_at_least_paths){.headerlink}]{.span}: []{#runfilessubject_contains_at_least_paths} ((collection of [`str`]) | [`runfiles`]) the paths that must exist. If a collection of strings is provided, they will be formatted using [`ExpectMeta.format_str`], so its template keywords can be directly passed. If a `runfiles` object is passed, it is converted to a set of path strings. {.starlark-object} ## RunfilesSubject.contains_at_least_predicates {.starlark-signature} RunfilesSubject.contains_at_least_predicates([matchers](#runfilessubject_contains_at_least_predicates_matchers)) Assert that the runfiles contains at least all of the provided matchers. The runfile paths must match all the matchers. It can contain extra elements. The multiplicity of matchers is respected. Checking that the relative order of matches is the same as the passed-in matchers order can done by calling `in_order()`. {#runfilessubject_contains_at_least_predicates_parameters} **PARAMETERS** [¶](#runfilessubject_contains_at_least_predicates_parameters){.headerlink} :[matchers[¶](#runfilessubject_contains_at_least_predicates_matchers){.headerlink}]{.span}: []{#runfilessubject_contains_at_least_predicates_matchers} ([`list`] of [`Matcher`]) (see `matchers` struct). They are passed string paths. {.starlark-object} ## RunfilesSubject.contains_exactly {.starlark-signature} RunfilesSubject.contains_exactly([paths](#runfilessubject_contains_exactly_paths)) Asserts that the runfiles contains_exactly the set of paths Method: RunfilesSubject.contains_exactly {#runfilessubject_contains_exactly_parameters} **PARAMETERS** [¶](#runfilessubject_contains_exactly_parameters){.headerlink} :[paths[¶](#runfilessubject_contains_exactly_paths){.headerlink}]{.span}: []{#runfilessubject_contains_exactly_paths} ([`collection`] of [`str`]) the paths to check. These will be formatted using `meta.format_str`, so its template keywords can be directly passed. All the paths must exist in the runfiles exactly as provided, and no extra paths may exist. {.starlark-object} ## RunfilesSubject.contains_exactly_predicates {.starlark-signature} RunfilesSubject.contains_exactly_predicates([expected](#runfilessubject_contains_exactly_predicates_expected)) Asserts the runfiles contains exactly the given matchers. See `CollectionSubject.contains_exactly_predicates` for details on behavior. {#runfilessubject_contains_exactly_predicates_parameters} **PARAMETERS** [¶](#runfilessubject_contains_exactly_predicates_parameters){.headerlink} :[expected[¶](#runfilessubject_contains_exactly_predicates_expected){.headerlink}]{.span}: []{#runfilessubject_contains_exactly_predicates_expected} ([`list`] of [`Matcher`]) that must match. They are passed string paths. {#runfilessubject_contains_exactly_predicates_returns} RETURNS [¶](#runfilessubject_contains_exactly_predicates_returns){.headerlink} : [`Ordered`] (see `_ordered_incorrectly_new`). {.starlark-object} ## RunfilesSubject.contains_none_of {.starlark-signature} RunfilesSubject.contains_none_of([paths](#runfilessubject_contains_none_of_paths), [require_workspace_prefix](#runfilessubject_contains_none_of_require_workspace_prefix)=True) Asserts the runfiles contain none of `paths`. Method: RunfilesSubject.contains_none_of {#runfilessubject_contains_none_of_parameters} **PARAMETERS** [¶](#runfilessubject_contains_none_of_parameters){.headerlink} :[paths[¶](#runfilessubject_contains_none_of_paths){.headerlink}]{.span}: []{#runfilessubject_contains_none_of_paths} ([`collection`] of [`str`]) the paths that should not exist. They should be runfiles root-relative paths (not workspace relative). The value is formatted using `ExpectMeta.format_str` and the current contextual keywords. :[require_workspace_prefix[¶](#runfilessubject_contains_none_of_require_workspace_prefix){.headerlink}]{.span}: []{#runfilessubject_contains_none_of_require_workspace_prefix} (_default `True`_) ([`bool`]) True to check that the path includes the workspace prefix. This is to guard against accidentallly passing a workspace relative path, which will (almost) never exist, and cause the test to always pass. Specify False if the file being checked for is _actually_ a runfiles-root relative path that isn't under the workspace itself. {.starlark-object} ## RunfilesSubject.contains_predicate {.starlark-signature} RunfilesSubject.contains_predicate([matcher](#runfilessubject_contains_predicate_matcher)) Asserts that `matcher` matches at least one value. Method: RunfilesSubject.contains_predicate {#runfilessubject_contains_predicate_parameters} **PARAMETERS** [¶](#runfilessubject_contains_predicate_parameters){.headerlink} :[matcher[¶](#runfilessubject_contains_predicate_matcher){.headerlink}]{.span}: []{#runfilessubject_contains_predicate_matcher} callable that takes 1 positional arg ([`str`] path) and returns boolean. {.starlark-object} ## RunfilesSubject.new {.starlark-signature} RunfilesSubject.new([runfiles](#runfilessubject_new_runfiles), [meta](#runfilessubject_new_meta), [kind](#runfilessubject_new_kind)=None) Creates a "RunfilesSubject" struct. Method: RunfilesSubject.new {#runfilessubject_new_parameters} **PARAMETERS** [¶](#runfilessubject_new_parameters){.headerlink} {.params-box} :[runfiles[¶](#runfilessubject_new_runfiles){.headerlink}]{.span}: []{#runfilessubject_new_runfiles} ([`runfiles`]) the runfiles to check against. :[meta[¶](#runfilessubject_new_meta){.headerlink}]{.span}: []{#runfilessubject_new_meta} ([`ExpectMeta`]) the metadata about the call chain. :[kind[¶](#runfilessubject_new_kind){.headerlink}]{.span}: []{#runfilessubject_new_kind} (_default `None`_) (optional [`str`]) what type of runfiles they are, usually "data" or "default". If not known or not applicable, use None. {#runfilessubject_new_returns} RETURNS [¶](#runfilessubject_new_returns){.headerlink} : [`RunfilesSubject`] object. {.starlark-object} ## RunfilesSubject.not_contains {.starlark-signature} RunfilesSubject.not_contains([path](#runfilessubject_not_contains_path), [require_workspace_prefix](#runfilessubject_not_contains_require_workspace_prefix)=True) Assert that the runfiles does not contain the given path. Method: RunfilesSubject.not_contains {#runfilessubject_not_contains_parameters} **PARAMETERS** [¶](#runfilessubject_not_contains_parameters){.headerlink} :[path[¶](#runfilessubject_not_contains_path){.headerlink}]{.span}: []{#runfilessubject_not_contains_path} ([`str`]) the path that should not exist. It should be a runfiles root-relative path (not workspace relative). The value is formatted using `format_str`, so its template keywords can be directly passed. :[require_workspace_prefix[¶](#runfilessubject_not_contains_require_workspace_prefix){.headerlink}]{.span}: []{#runfilessubject_not_contains_require_workspace_prefix} (_default `True`_) ([`bool`]) True to check that the path includes the workspace prefix. This is to guard against accidentallly passing a workspace relative path, which will (almost) never exist, and cause the test to always pass. Specify False if the file being checked for is _actually_ a runfiles-root relative path that isn't under the workspace itself. {.starlark-object} ## RunfilesSubject.not_contains_predicate {.starlark-signature} RunfilesSubject.not_contains_predicate([matcher](#runfilessubject_not_contains_predicate_matcher)) Asserts that none of the runfiles match `matcher`. Method: RunfilesSubject.not_contains_predicate {#runfilessubject_not_contains_predicate_parameters} **PARAMETERS** [¶](#runfilessubject_not_contains_predicate_parameters){.headerlink} :[matcher[¶](#runfilessubject_not_contains_predicate_matcher){.headerlink}]{.span}: []{#runfilessubject_not_contains_predicate_matcher} [`Matcher`] that accepts a string (runfiles root-relative path). [`Action`]: https://bazel.build/rules/lib/Action [`ActionSubject`]: /api/action_subject [`bool`]: https://bazel.build/rules/lib/bool [`BoolSubject`]: /api/bool_subject [`CollectionSubject`]: /api/collection_subject [`depset`]: https://bazel.build/rules/lib/depset [`DepsetFileSubject`]: /api/depset_file_subject [`dict`]: https://bazel.build/rules/lib/dict [`DictSubject`]: /api/dict_subject [`Expect`]: /api/expect [`ExpectMeta`]: /api/expect_meta [`File`]: https://bazel.build/rules/lib/File [`FileSubject`]: /api/file_subject [`format_str`]: /api/expect_meta.html#expectmeta-format-str [`IntSubject`]: /api/int_subject [`Label`]: https://bazel.build/rules/lib/Label [`LabelSubject`]: /api/label_subject [`list`]: https://bazel.build/rules/lib/list [`Ordered`]: /api/ordered [`RunfilesSubject`]: /api/runfiles_subject [`str`]: https://bazel.build/rules/lib/string [`struct`]: https://bazel.build/rules/lib/builtins/struct [`StrSubject`]: /api/str_subject [`StructSubject`]: /api/struct_subject [`Target`]: https://bazel.build/rules/lib/Target [`TargetSubject`]: /api/target_subject [target-name]: https://bazel.build/concepts/labels#target-names [attr-label]: https://bazel.build/concepts/labels