tests.test_envvar module¶
- tests.test_envvar.test_machine_envvars_apply_to_the_built_in_default_only(invoke, args, envvar, default_map, expected)[source]¶
A machine-wide variable fills in only for a value nothing else set.
- tests.test_envvar.test_show_auto_envvar_help(invoke, cmd_decorator, option_help)[source]¶
Check that the auto-generated envvar appears in the help screen with the extra variants.
Checks that https://github.com/pallets/click/issues/2483 is addressed.
- tests.test_envvar.test_auto_envvar_parsing(invoke, cmd_decorator, envvars, expected_flag)[source]¶
This test highlights the way Click recognize and parse envvars.
It shows that the default behavior is not ideal, and covers how
commandimproves the situation by normalizing the envvar name.
- tests.test_envvar.test_empty_envvar_falls_back_to_the_default(invoke, cmd_decorator, default)[source]¶
An empty variable is read as unset, so the flag keeps its own default.
Pins the rule the
""row ofenvvars_test_cases()relies on:Parameter.resolve_envvar_valueguards its lookup with a bareif rv, so an empty value never reaches the flag’s type. TheFalsethat row expects is the option’s default showing through, which is why flipping the default flips the outcome with it.
- tests.test_envvar.test_env_copy_removes_on_none(monkeypatch)[source]¶
A
Nonevalue drops its variable, the way Click’sCliRunnerreads it.The only way to hide an inherited variable from a child: assigning the empty string leaves it set, which
parse_envvar_flag()counts as activation.