diff options
Diffstat (limited to 'tests/test_utils.py')
-rw-r--r-- | tests/test_utils.py | 16 |
1 files changed, 16 insertions, 0 deletions
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") |