Installation
The current stable release:
pip install pytest_click
Usage
`pytest-click comes with some configurable fixtures - cli_runner and isolated_cli_runner.
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"
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:
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.
Metadata
Release files for pytest-click 1.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| pytest_click-1.1.0.tar.gz | 5.1 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pytest_click-1.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 9.2 kB
Release files / pytest_click-1.1.0.tar.gz
| Download URL | pytest_click-1.1.0.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
fdd9f6721f877dda021e7c5dc73e70aecd37e5ed23ec6820f8a7b3fd7b4f8d30
|
|
BLAKE2b-256 checksum How to use checksums |
ececbca3cd29ba2b025ae41666b851f6ff05fb77cb4c13719baaeda6a757772a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Release files / pytest_click-1.1.0-py3-none-any.whl
| Download URL | pytest_click-1.1.0-py3-none-any.whl |
|---|---|
| Size | 4.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
eade4742c2f02c345e78a32534a43e8db04acf98d415090539dacc880b7cd0e9
|
|
BLAKE2b-256 checksum How to use checksums |
721aeb53371999b94b3c995c00117f3a232dbf6f56c7152a52cf3e3777e7d49d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10
|
Security for pytest-click 1.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.