summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorGregory Pakosz <gregory.pakosz@gmail.com>2019-03-21 09:35:46 +0100
committerDavid Lord <davidism@gmail.com>2020-02-22 13:51:34 -0800
commit91ea0de0ec00a08eb36b138029a401baf51c71b4 (patch)
treeec1038846cf72e3defc64292dd2a348a18bc68ed /tests
parent93d947c2e3c5584729d7de35644f778c0e8e147e (diff)
downloadclick-91ea0de0ec00a08eb36b138029a401baf51c71b4.tar.gz
prevent automatic environment variables from containing dashes
Diffstat (limited to 'tests')
-rw-r--r--tests/test_options.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/test_options.py b/tests/test_options.py
index 4ad7f3c..bad4f42 100644
--- a/tests/test_options.py
+++ b/tests/test_options.py
@@ -273,6 +273,22 @@ def test_show_envvar_auto_prefix(runner):
assert 'TEST_ARG1' in result.output
+def test_show_envvar_auto_prefix_dash_in_command(runner):
+ @click.group()
+ def cli():
+ pass
+
+ @cli.command()
+ @click.option('--baz', show_envvar=True)
+ def foo_bar(baz):
+ pass
+
+ result = runner.invoke(cli, ['foo-bar', '--help'],
+ auto_envvar_prefix='TEST')
+ assert not result.exception
+ assert 'TEST_FOO_BAR_BAZ' in result.output
+
+
def test_custom_validation(runner):
def validate_pos_int(ctx, param, value):
if value < 0: