Pytest¶
Important
For these helpers to work, you need to install click_extra’s additional dependencies from the pytest extra group:
$ pip install click_extra[pytest]
Utility functions¶
Todo
Write example and tutorial.
Fixtures¶
Todo
Write example and tutorial.
click_extra.pytest API¶
… py:module:: click_extra.pytest
Pytest fixtures and marks to help testing Click CLIs.
… py:function:: extra_runner()
- module:
click_extra.pytest
Runner fixture for
click.testing.ExtraCliRunner.
… py:function:: invoke(extra_runner)
- module:
click_extra.pytest
Invoke fixture shorthand for
click.testing.ExtraCliRunner.invoke.
… py:function:: command_decorators(no_commands=False, no_groups=False, no_click=False, no_cloup=False, no_extra=False, with_parenthesis=True, with_types=False)
- module:
click_extra.pytest
Returns collection of Pytest parameters to test all command-like decorators.
Returns:
click.commandclick.command()cloup.commandcloup.command()click_extra.commandclick_extra.command()click.groupclick.group()cloup.groupcloup.group()click_extra.groupclick_extra.group()
- rtype:
- sphinx_autodoc_typehints_type:
\:py\:class\:\tuple`\ \[:py:class:`~_pytest.mark.structures.ParameterSet`, :py:data:`…<Ellipsis>`]`
… py:function:: option_decorators(no_options=False, no_arguments=False, no_click=False, no_cloup=False, no_extra=False, with_parenthesis=True, with_types=False)
- module:
click_extra.pytest
Returns collection of Pytest parameters to test all parameter-like decorators.
Returns:
click.optionclick.option()cloup.optioncloup.option()click_extra.optionclick_extra.option()click.argumentclick.argument()cloup.argumentcloup.argument()click_extra.argumentclick_extra.argument()
- rtype:
- sphinx_autodoc_typehints_type:
\:py\:class\:\tuple`\ \[:py:class:`~_pytest.mark.structures.ParameterSet`, :py:data:`…<Ellipsis>`]`
… py:function:: create_config(tmp_path)
- module:
click_extra.pytest
A generic fixture to produce a temporary configuration file.
… py:function:: assert_output_regex(request)
- module:
click_extra.pytest
An assert-like utility for Pytest to compare CLI output against the regex.
Designed for the regexes defined above.