diff options
author | David Lord <davidism@gmail.com> | 2022-03-19 11:00:12 -0700 |
---|---|---|
committer | David Lord <davidism@gmail.com> | 2022-03-19 11:00:12 -0700 |
commit | 7d3a871eb71694e99438254686c139122bc4be64 (patch) | |
tree | e784f20837959b7e9382b2cbbe7e96b63fac254a /tests/test_chain.py | |
parent | bf9da4838986af3bc09a1b16974d154c61dcbe3f (diff) | |
download | click-7d3a871eb71694e99438254686c139122bc4be64.tar.gz |
group without command passes return value to result callback
Diffstat (limited to 'tests/test_chain.py')
-rw-r--r-- | tests/test_chain.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/tests/test_chain.py b/tests/test_chain.py index 3431009..6b2eae3 100644 --- a/tests/test_chain.py +++ b/tests/test_chain.py @@ -85,20 +85,20 @@ def test_chaining_with_options(runner): assert result.output.splitlines() == ["bdist called 1", "sdist called 2"] -@pytest.mark.parametrize(("chain", "expect"), [(False, "None"), (True, "[]")]) +@pytest.mark.parametrize(("chain", "expect"), [(False, "1"), (True, "[]")]) def test_no_command_result_callback(runner, chain, expect): """When a group has ``invoke_without_command=True``, the result callback is always invoked. A regular group invokes it with - ``None``, a chained group with ``[]``. + its return value, a chained group with ``[]``. """ @click.group(invoke_without_command=True, chain=chain) def cli(): - pass + return 1 @cli.result_callback() def process_result(result): - click.echo(str(result), nl=False) + click.echo(result, nl=False) result = runner.invoke(cli, []) assert result.output == expect |