summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorDavid Lord <davidism@gmail.com>2022-03-28 10:20:42 -0700
committerDavid Lord <davidism@gmail.com>2022-03-28 10:20:42 -0700
commit8d7f03dac8739afed890af0c0921965786c5e83c (patch)
tree60bcd4eb1a1b31133fdae783787a1c3ecd811328 /tests
parentef11be6e49e19a055fe7e5a89f0f1f4062c68dba (diff)
downloadclick-8d7f03dac8739afed890af0c0921965786c5e83c.tar.gz
treat empty auto_envvar as None
Diffstat (limited to 'tests')
-rw-r--r--tests/test_options.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/tests/test_options.py b/tests/test_options.py
index 3beff11..2e1f291 100644
--- a/tests/test_options.py
+++ b/tests/test_options.py
@@ -153,14 +153,15 @@ def test_init_bad_default_list(runner, multiple, nargs, default):
click.Option(["-a"], type=type, multiple=multiple, nargs=nargs, default=default)
-def test_empty_envvar(runner):
+@pytest.mark.parametrize("env_key", ["MYPATH", "AUTO_MYPATH"])
+def test_empty_envvar(runner, env_key):
@click.command()
@click.option("--mypath", type=click.Path(exists=True), envvar="MYPATH")
def cli(mypath):
click.echo(f"mypath: {mypath}")
- result = runner.invoke(cli, [], env={"MYPATH": ""})
- assert result.exit_code == 0
+ result = runner.invoke(cli, env={env_key: ""}, auto_envvar_prefix="AUTO")
+ assert result.exception is None
assert result.output == "mypath: None\n"