diff options
author | Tom Dalton <tom.dalton@fanduel.com> | 2019-05-08 15:48:36 +0100 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2020-08-10 07:40:46 -0700 |
commit | a7436e89bbebd361d8d97d1261db0bd399c84b31 (patch) | |
tree | dcd6776823f5d78112a8c7018bcb6d28a9b71306 /tests/test_testing.py | |
parent | 563b1a7116a6806e699d31d327dd9bca93c40cb3 (diff) | |
download | click-a7436e89bbebd361d8d97d1261db0bd399c84b31.tar.gz |
test result captures command return value
Diffstat (limited to 'tests/test_testing.py')
-rw-r--r-- | tests/test_testing.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/test_testing.py b/tests/test_testing.py index 7360473..86c8708 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -295,3 +295,16 @@ def test_setting_prog_name_in_extra(): result = runner.invoke(cli, prog_name="foobar") assert not result.exception assert result.output == "ok\n" + + +def test_command_standalone_mode_returns_value(): + @click.command() + def cli(): + click.echo("ok") + return "Hello, World!" + + runner = CliRunner() + result = runner.invoke(cli, standalone_mode=False) + assert result.output == "ok\n" + assert result.return_value == "Hello, World!" + assert result.exit_code == 0 |