diff options
author | David Lord <davidism@gmail.com> | 2021-10-25 08:46:34 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2021-10-25 08:46:34 -0700 |
commit | 0c85d80b07742b9f9ed4d583d694c37fce1d1292 (patch) | |
tree | 0696c73b5d1abfe4d5eb1f6ef1328985d2a710e9 /tests | |
parent | 65eceb08e392e74dcc761be2090e951274ccbe36 (diff) | |
parent | e415d3a811fda506c8d7917e615b97ae9dcd1194 (diff) | |
download | click-0c85d80b07742b9f9ed4d583d694c37fce1d1292.tar.gz |
Merge branch '8.0.x'
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_arguments.py | 4 | ||||
-rw-r--r-- | tests/test_utils.py | 16 |
2 files changed, 18 insertions, 2 deletions
diff --git a/tests/test_arguments.py b/tests/test_arguments.py index f4d7afd..b4719d6 100644 --- a/tests/test_arguments.py +++ b/tests/test_arguments.py @@ -120,9 +120,9 @@ def test_file_args(runner): assert result.exit_code == 0 -def test_path_args(runner): +def test_path_allow_dash(runner): @click.command() - @click.argument("input", type=click.Path(dir_okay=False, allow_dash=True)) + @click.argument("input", type=click.Path(allow_dash=True)) def foo(input): click.echo(input) diff --git a/tests/test_utils.py b/tests/test_utils.py index 271177d..519b1a6 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -320,6 +320,22 @@ def test_open_file(runner): assert result.output == "foobar\nmeep\n" +def test_open_file_pathlib_dash(runner): + @click.command() + @click.argument( + "filename", type=click.Path(allow_dash=True, path_type=pathlib.Path) + ) + def cli(filename): + click.echo(str(type(filename))) + + with click.open_file(filename) as f: + click.echo(f.read()) + + result = runner.invoke(cli, ["-"], input="value") + assert result.exception is None + assert result.output == "pathlib.Path\nvalue\n" + + def test_open_file_ignore_errors_stdin(runner): @click.command() @click.argument("filename") |