Metadata-Version: 2.1
Name: pytest-click
Version: 1.0.2
Summary: Py.test plugin for Click
Home-page: https://github.com/Stranger6667/pytest-click
Author: Dmitry Dygalo
Author-email: dadygalo@gmail.com
Maintainer: Dmitry Dygalo
Maintainer-email: dadygalo@gmail.com
License: MIT
Description: pytest-click
        ============
        Py.test plugin for `Click <http://click.pocoo.org/>`_.
        
        |Build| |Coverage| |Version| |Python versions| |License|
        
        
        Installation
        ------------
        
        The current stable release:
        
        ::
        
            pip install pytest_click
        
        Usage
        -----
        
        pytest-click comes with some configurable fixtures - ``cli_runner`` and ``isolated_cli_runner``.
        
        .. code:: python
        
            import click
        
        
            def test_cli(cli_runner):
                @click.command()
                @click.argument("name")
                def hello(name):
                    click.echo("Hello %s!" % name)
        
                result = cli_runner.invoke(hello, ["Peter"])
                assert result.exit_code == 0
                assert result.output == "Hello Peter!\n"
        
        .. code:: python
        
            import click
        
        
            def test_fixture(isolated_cli_runner):
                @click.command()
                @click.argument("f", type=click.File())
                def cat(f):
                    click.echo(f.read())
        
                with open("hello.txt", "w") as f:
                    f.write("Hello World!")
        
                result = isolated_cli_runner.invoke(cat, ["hello.txt"])
                assert result.exit_code == 0
                assert result.output == "Hello World!\n"
        
        Both runners can be configured via ``runner_setup`` mark:
        
        .. code:: python
        
            import pytest
        
        
            @pytest.mark.runner_setup(charset="cp1251", env={"test": 1}, echo_stdin=True)
            def test_runner_setup(cli_runner):
                ...
        
        All kwargs will be passed to ``click.testing.CliRunner`` initialization.
        
        
        .. |Build| image:: image:: https://github.com/Stranger6667/pytest-click/workflows/build/badge.svg
           :target: https://github.com/Stranger6667/pytest-click/actions
        .. |Coverage| image:: https://codecov.io/github/Stranger6667/pytest-click/coverage.svg?branch=master
            :target: https://codecov.io/github/Stranger6667/pytest-click?branch=master
        .. |Version| image:: https://img.shields.io/pypi/v/pytest-click.svg
           :target: https://pypi.org/project/pytest-click/
        .. |Python versions| image:: https://img.shields.io/pypi/pyversions/pytest-click.svg
           :target: https://pypi.org/project/pytest-click/
        .. |License| image:: https://img.shields.io/pypi/l/pytest-click.svg
           :target: https://opensource.org/licenses/MIT
        
Platform: UNKNOWN
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Programming Language :: Python :: Implementation :: PyPy
Classifier: Topic :: Software Development :: Testing
Description-Content-Type: text/x-rst
