A pytest plugin for colorful print statements
Project description
pytest-crayons
A pytest plugin for colorful print statements.
Installation
pip install pytest-crayons
Usage
- Include a color fixture in the param list of a test.
- Then use it instead of
print.
def test_magenta(magenta):
magenta("this should be magenta")
Just like normal print statements, you only see the output if:
- There's an failure in the test.
- or you pass in
-sor--capture=no - or you wrap the statement in a
with capsys.disabled():block.
For our examples, we'll use -s:
Available colors
- red
- green
- yellow
- blue
- magenta
- cyan
Example with all colors:
def test_colors(red, green, yellow, blue, magenta, cyan):
print("") # for the newline
red("this should be red")
green("this should be green")
yellow("this should be yellow")
blue("this should be blue")
magenta("this should be magenta")
cyan("this should be cyan")
This was included in a talk for PyCascades 2023
- Conference talk page : Sharing is Caring - Sharing pytest Fixtures
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pytest_crayons-0.0.9.tar.gz.
File metadata
- Download URL: pytest_crayons-0.0.9.tar.gz
- Upload date:
- Size: 90.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2f508afce82a71fa59d68758a70c2c703c30d01211926d29e00fa219797437cf
|
|
| MD5 |
3cc2e35ccf12fa4a7216f321f54872bf
|
|
| BLAKE2b-256 |
79999bd978f081053d89b21571be49dc09635aa57dc5d00568895ed7d4db1c17
|
Provenance
The following attestation bundles were made for pytest_crayons-0.0.9.tar.gz:
Publisher:
pypi-package.yml on okken/pytest-crayons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_crayons-0.0.9.tar.gz -
Subject digest:
2f508afce82a71fa59d68758a70c2c703c30d01211926d29e00fa219797437cf - Sigstore transparency entry: 606453539
- Sigstore integration time:
-
Permalink:
okken/pytest-crayons@3b27ee076769acfe118140253179504a39b6033c -
Branch / Tag:
refs/tags/v0.0.9 - Owner: https://github.com/okken
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-package.yml@3b27ee076769acfe118140253179504a39b6033c -
Trigger Event:
release
-
Statement type:
File details
Details for the file pytest_crayons-0.0.9-py3-none-any.whl.
File metadata
- Download URL: pytest_crayons-0.0.9-py3-none-any.whl
- Upload date:
- Size: 4.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
29acf623c1155799cff226de86a05a66aeff559d15a80bfe56b69921afd6d8b6
|
|
| MD5 |
28b899bc83c8615b79012a7fd677fe10
|
|
| BLAKE2b-256 |
caa6b8150650f331672ddb61b6bfac2347faa75dbf26349fc003f76aee793b48
|
Provenance
The following attestation bundles were made for pytest_crayons-0.0.9-py3-none-any.whl:
Publisher:
pypi-package.yml on okken/pytest-crayons
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pytest_crayons-0.0.9-py3-none-any.whl -
Subject digest:
29acf623c1155799cff226de86a05a66aeff559d15a80bfe56b69921afd6d8b6 - Sigstore transparency entry: 606453542
- Sigstore integration time:
-
Permalink:
okken/pytest-crayons@3b27ee076769acfe118140253179504a39b6033c -
Branch / Tag:
refs/tags/v0.0.9 - Owner: https://github.com/okken
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-package.yml@3b27ee076769acfe118140253179504a39b6033c -
Trigger Event:
release
-
Statement type: