Skip to main content

pytest-crayons

A pytest plugin for colorful print statements.

Installation

pip install pytest-crayons

Usage

  1. Include a color fixture in the param list of a test.
  2. 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 -s or --capture=no
  • or you wrap the statement in a with capsys.disabled(): block.

For our examples, we'll use -s:

output of test_something

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")

output of test_colors

This was included in a talk for PyCascades 2023

Release files for pytest-crayons 0.0.9

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-crayons 0.0.9
File Size Uploaded
pytest_crayons-0.0.9.tar.gz 90.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-crayons 0.0.9
File Interpreter ABI Platform
pytest_crayons-0.0.9-py3-none-any.whl Python 3 none any Details

Total release size: 95.1 kB

Release files / pytest_crayons-0.0.9.tar.gz

Download URL pytest_crayons-0.0.9.tar.gz
Size 90.9 kB
Tags Source
SHA-256 checksum
How to use checksums
2f508afce82a71fa59d68758a70c2c703c30d01211926d29e00fa219797437cf
BLAKE2b-256 checksum
How to use checksums
79999bd978f081053d89b21571be49dc09635aa57dc5d00568895ed7d4db1c17
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2025.

Transparency log

Release files / pytest_crayons-0.0.9-py3-none-any.whl

Download URL pytest_crayons-0.0.9-py3-none-any.whl
Size 4.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
29acf623c1155799cff226de86a05a66aeff559d15a80bfe56b69921afd6d8b6
BLAKE2b-256 checksum
How to use checksums
caa6b8150650f331672ddb61b6bfac2347faa75dbf26349fc003f76aee793b48
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 14, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.9 This release

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

0.0.3

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page