{"id":21800,"library":"pytest-click","title":"pytest-click","description":"PyTest plugin for Click applications. Allows testing Click commands with a simple fixture-based interface. Current version: 1.1.0.","status":"active","version":"1.1.0","language":"python","source_language":"en","source_url":"https://github.com/Stranger6667/pytest-click","tags":["pytest","click","testing","plugin"],"install":[{"cmd":"pip install pytest-click","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Plugin host","package":"pytest","optional":false}],"imports":[{"note":"CliRunner is part of click.testing, not pytest-click","wrong":"from pytest_click import CliRunner","symbol":"CliRunner","correct":"from click.testing import CliRunner"},{"note":"pytest-click does not re-export click","symbol":"click","correct":"import click"}],"quickstart":{"code":"import click\nfrom click.testing import CliRunner\n\n@click.command()\ndef hello():\n    click.echo('Hello, World!')\n\ndef test_hello():\n    runner = CliRunner()\n    result = runner.invoke(hello, [])\n    assert result.exit_code == 0\n    assert 'Hello, World!' in result.output","lang":"python","description":"Minimal test using CliRunner from click.testing."},"warnings":[{"fix":"Use `from click.testing import CliRunner`.","message":"pytest-click does not export any custom classes. The `CliRunner` class comes from `click.testing`. Common mistake: `from pytest_click import CliRunner` will fail.","severity":"gotcha","affected_versions":"all"},{"fix":"If you rely on stderr mixing, configure the runner fixture manually: `runner = CliRunner(mix_stderr=True)`.","message":"The `runner` fixture provided by pytest-click is set up with `mix_stderr=False` by default, which differs from Click's default `mix_stderr=True`. This may cause tests to pass locally but fail in CI if stderr is not handled correctly.","severity":"gotcha","affected_versions":"1.0+"}],"env_vars":null,"last_verified":"2026-04-27T00:00:00.000Z","next_check":"2026-07-26T00:00:00.000Z","problems":[{"fix":"Install pytest-click: pip install pytest-click, then use `from click.testing import CliRunner`.","cause":"Trying to import from pytest_click instead of click.testing.","error":"ModuleNotFoundError: No module named 'pytest_click'"},{"fix":"Install click: pip install click, then use `from click.testing import CliRunner`.","cause":"Importing `CliRunner` from `click` instead of `click.testing`. Older Click versions might not have `click.testing`; ensure Click is installed.","error":"AttributeError: module 'click' has no attribute 'CliRunner'"},{"fix":"Ensure you pass the command as first argument: `runner.invoke(my_command, ['arg'])`.","cause":"Calling `runner.invoke()` without passing the Click command object.","error":"TypeError: invoke() missing 1 required positional argument: 'cli'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}