summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authoricreatedanaccount <pierluc.boudreau@gmail.com>2019-05-07 11:46:59 -0400
committerDavid Lord <davidism@gmail.com>2020-02-19 21:47:25 -0800
commit2ddc9afdc290b3dfc82f20b2ddb510cc8ab64a5b (patch)
treef7b1fe681472d5a98caf4ecc9c3d00d843d851bc /tests
parent9ea9666f0f5646713be799e764ecc252c9f7ebbd (diff)
downloadclick-2ddc9afdc290b3dfc82f20b2ddb510cc8ab64a5b.tar.gz
Formatting file option prompting to path only
Diffstat (limited to 'tests')
-rw-r--r--tests/static/config.json3
-rw-r--r--tests/test_termui.py13
2 files changed, 16 insertions, 0 deletions
diff --git a/tests/static/config.json b/tests/static/config.json
new file mode 100644
index 0000000..005c33c
--- /dev/null
+++ b/tests/static/config.json
@@ -0,0 +1,3 @@
+{
+ "TEST_KEY": "foo"
+}
diff --git a/tests/test_termui.py b/tests/test_termui.py
index 845cb38..ba5538a 100644
--- a/tests/test_termui.py
+++ b/tests/test_termui.py
@@ -3,6 +3,7 @@ import pytest
import click
import time
+import os
import click._termui_impl
from click._compat import WIN
@@ -225,6 +226,18 @@ def test_choices_list_in_prompt(runner, monkeypatch):
assert '(none, day, week, month)' not in result.output
+def test_default_prompt_format(runner):
+ path_default = os.path.join(os.path.dirname(__file__), "static/config.json")
+
+ @click.command()
+ @click.option('-f', default=path_default, prompt='file', type=click.File('r'))
+ def cli_with_text_io_wrapper_default(f):
+ pass
+
+ result = runner.invoke(cli_with_text_io_wrapper_default, [])
+ assert result.output == 'file [%s]: \n' % path_default
+
+
def test_secho(runner):
with runner.isolation() as outstreams:
click.secho(None, nl=False)