# ActionSubject {.starlark-object} ## ActionSubject.argv {.starlark-signature} ActionSubject.argv() Returns a CollectionSubject for the action's argv. Method: ActionSubject.argv {#actionsubject_argv_returns} RETURNS [¶](#actionsubject_argv_returns){.headerlink} : [`CollectionSubject`] object. {.starlark-object} ## ActionSubject.contains_at_least_args {.starlark-signature} ActionSubject.contains_at_least_args([args](#actionsubject_contains_at_least_args_args)) Assert that an action contains at least the provided args. Method: ActionSubject.contains_at_least_args Example usage: expect(env).that_action(action).contains_at_least_args(["foo", "bar"]). {#actionsubject_contains_at_least_args_parameters} **PARAMETERS** [¶](#actionsubject_contains_at_least_args_parameters){.headerlink} :[args[¶](#actionsubject_contains_at_least_args_args){.headerlink}]{.span}: []{#actionsubject_contains_at_least_args_args} ([`list`] of [`str`]) all the args must be in the argv exactly as provided. Multiplicity is respected. {#actionsubject_contains_at_least_args_returns} RETURNS [¶](#actionsubject_contains_at_least_args_returns){.headerlink} : [`Ordered`] (see `_ordered_incorrectly_new`). {.starlark-object} ## ActionSubject.contains_at_least_inputs {.starlark-signature} ActionSubject.contains_at_least_inputs([inputs](#actionsubject_contains_at_least_inputs_inputs)) Assert the action's inputs contains at least all of `inputs`. Method: ActionSubject.contains_at_least_inputs Example usage: expect(env).that_action(action).contains_at_least_inputs([]) {#actionsubject_contains_at_least_inputs_parameters} **PARAMETERS** [¶](#actionsubject_contains_at_least_inputs_parameters){.headerlink} :[inputs[¶](#actionsubject_contains_at_least_inputs_inputs){.headerlink}]{.span}: []{#actionsubject_contains_at_least_inputs_inputs} (collection of [`File`]) All must be present. Multiplicity is respected. {#actionsubject_contains_at_least_inputs_returns} RETURNS [¶](#actionsubject_contains_at_least_inputs_returns){.headerlink} : [`Ordered`] (see `_ordered_incorrectly_new`). {.starlark-object} ## ActionSubject.contains_flag_values {.starlark-signature} ActionSubject.contains_flag_values([flag_values](#actionsubject_contains_flag_values_flag_values)) Assert that an action's argv has the given ("--flag", "value") entries. Method: ActionSubject.contains_flag_values This parses the argv, assuming the typical formats (`--flag=value`, `--flag value`, and `--flag`). Note, however, that for the `--flag value` and `--flag` forms, the parsing can't know how many args, if any, a flag actually consumes, so it simply takes the first following arg, if any, as the matching value. NOTE: This function can give misleading results checking flags that don't consume any args (e.g. boolean flags). Use `has_flags_specified()` to test for such flags. Such cases will either show the subsequent arg as the value, or None if the flag was the last arg in argv. Example usage, given `argv = ["--b=1", "--c", "2"]`: expect(env).that_action(action).contains_flag_values([ ("--b", "1"), ("--c", "2") ]) {#actionsubject_contains_flag_values_parameters} **PARAMETERS** [¶](#actionsubject_contains_flag_values_parameters){.headerlink} :[flag_values[¶](#actionsubject_contains_flag_values_flag_values){.headerlink}]{.span}: []{#actionsubject_contains_flag_values_flag_values} ([`list`] of ([`str`] name, [`str`]) tuples) Include the leading "--" in the flag name. Order and duplicates aren't checked. Flags without a value found use `None` as their value. {.starlark-object} ## ActionSubject.contains_none_of_flag_values {.starlark-signature} ActionSubject.contains_none_of_flag_values([flag_values](#actionsubject_contains_none_of_flag_values_flag_values)) Assert that an action's argv has none of the given ("--flag", "value") entries. Method: ActionSubject.contains_none_of_flag_values This parses the argv, assuming the typical formats (`--flag=value`, `--flag value`, and `--flag`). Note, however, that for the `--flag value` and `--flag` forms, the parsing can't know how many args, if any, a flag actually consumes, so it simply takes the first following arg, if any, as the matching value. NOTE: This function can give misleading results checking flags that don't consume any args (e.g. boolean flags). Use `has_flags_specified()` to test for such flags. {#actionsubject_contains_none_of_flag_values_parameters} **PARAMETERS** [¶](#actionsubject_contains_none_of_flag_values_parameters){.headerlink} :[flag_values[¶](#actionsubject_contains_none_of_flag_values_flag_values){.headerlink}]{.span}: []{#actionsubject_contains_none_of_flag_values_flag_values} ([`list`] of ([`str`] name, [`str`] value) tuples) Include the leading "--" in the flag name. Order and duplicates aren't checked. {.starlark-object} ## ActionSubject.content {.starlark-signature} ActionSubject.content() Returns a `StrSubject` for `Action.content`. Method: ActionSubject.content {#actionsubject_content_returns} RETURNS [¶](#actionsubject_content_returns){.headerlink} : [`StrSubject`] object. {.starlark-object} ## ActionSubject.env {.starlark-signature} ActionSubject.env() Returns a `DictSubject` for `Action.env`. Method: ActionSubject.env {.starlark-object} ## ActionSubject.execution_info {.starlark-signature} ActionSubject.execution_info() Returns a `DictSubject` for `Action.execution_info`. Method: ActionSubject.execution_info NOTE: This method only works if `execution_info` is available in Bazel's `ActionApi`. {#actionsubject_execution_info_returns} RETURNS [¶](#actionsubject_execution_info_returns){.headerlink} : [`DictSubject`] object. {.starlark-object} ## ActionSubject.has_flags_specified {.starlark-signature} ActionSubject.has_flags_specified([flags](#actionsubject_has_flags_specified_flags)) Assert that an action has the given flags present (but ignore any value). Method: ActionSubject.has_flags_specified This parses the argv, assuming the typical formats (`--flag=value`, `--flag value`, and `--flag`). Any of the formats will be matched. Example usage, given `argv = ["--a", "--b=1", "--c", "2"]`: expect(env).that_action(action).has_flags_specified([ "--a", "--b", "--c"]) {#actionsubject_has_flags_specified_parameters} **PARAMETERS** [¶](#actionsubject_has_flags_specified_parameters){.headerlink} :[flags[¶](#actionsubject_has_flags_specified_flags){.headerlink}]{.span}: []{#actionsubject_has_flags_specified_flags} ([`list`] of [`str`]) The flags to check for. Include the leading "--". Multiplicity is respected. A flag is considered present if any of these forms are detected: `--flag=value`, `--flag value`, or a lone `--flag`. {#actionsubject_has_flags_specified_returns} RETURNS [¶](#actionsubject_has_flags_specified_returns){.headerlink} : [`Ordered`] (see `_ordered_incorrectly_new`). {.starlark-object} ## ActionSubject.inputs {.starlark-signature} ActionSubject.inputs() Returns a DepsetFileSubject for the action's inputs. Method: ActionSubject.inputs {#actionsubject_inputs_returns} RETURNS [¶](#actionsubject_inputs_returns){.headerlink} : `DepsetFileSubject` of the action's inputs. {.starlark-object} ## ActionSubject.mnemonic {.starlark-signature} ActionSubject.mnemonic() Returns a `StrSubject` for the action's mnemonic. Method: ActionSubject.mnemonic {#actionsubject_mnemonic_returns} RETURNS [¶](#actionsubject_mnemonic_returns){.headerlink} : [`StrSubject`] object. {.starlark-object} ## ActionSubject.new {.starlark-signature} ActionSubject.new([action](#actionsubject_new_action), [meta](#actionsubject_new_meta)) Creates an "ActionSubject" struct. Method: ActionSubject.new Example usage: expect(env).that_action(action).not_contains_arg("foo") {#actionsubject_new_parameters} **PARAMETERS** [¶](#actionsubject_new_parameters){.headerlink} {.params-box} :[action[¶](#actionsubject_new_action){.headerlink}]{.span}: []{#actionsubject_new_action} ([`Action`]) value to check against. :[meta[¶](#actionsubject_new_meta){.headerlink}]{.span}: []{#actionsubject_new_meta} ([`ExpectMeta`]) of call chain information. {#actionsubject_new_returns} RETURNS [¶](#actionsubject_new_returns){.headerlink} : [`ActionSubject`] object. {.starlark-object} ## ActionSubject.not_contains_arg {.starlark-signature} ActionSubject.not_contains_arg([arg](#actionsubject_not_contains_arg_arg)) Assert that an action does not contain an arg. Example usage: expect(env).that_action(action).not_contains_arg("should-not-exist") {#actionsubject_not_contains_arg_parameters} **PARAMETERS** [¶](#actionsubject_not_contains_arg_parameters){.headerlink} :[arg[¶](#actionsubject_not_contains_arg_arg){.headerlink}]{.span}: []{#actionsubject_not_contains_arg_arg} ([`str`]) the arg that cannot be present in the argv. {.starlark-object} ## ActionSubject.parse_flags {.starlark-signature} ActionSubject.parse_flags([argv](#actionsubject_parse_flags_argv)) {#actionsubject_parse_flags_parameters} **PARAMETERS** [¶](#actionsubject_parse_flags_parameters){.headerlink} {.params-box} :[argv[¶](#actionsubject_parse_flags_argv){.headerlink}]{.span}: []{#actionsubject_parse_flags_argv} _undocumented_ {.starlark-object} ## ActionSubject.substitutions {.starlark-signature} ActionSubject.substitutions() Creates a `DictSubject` to assert on the substitutions dict. Method: ActionSubject.substitutions. {#actionsubject_substitutions_returns} RETURNS [¶](#actionsubject_substitutions_returns){.headerlink} : `DictSubject` struct. [`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