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_something(blue):
... # some code
blue("a print statement, that shows up blue")
... # more test code
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
:
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 in red")
green("this should be in green")
yellow("this should be in yellow")
blue("this should be in blue")
magenta("this should be in magenta")
cyan("this should be in cyan")
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pytest-crayons-0.0.2.tar.gz
(62.3 kB
view details)
Built Distribution
File details
Details for the file pytest-crayons-0.0.2.tar.gz
.
File metadata
- Download URL: pytest-crayons-0.0.2.tar.gz
- Upload date:
- Size: 62.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | c70b8cbf9e2c9d18dae95ec6b0d7c463b5d85356bc1cd204a94cf38a25e2949d |
|
MD5 | d70e1162fdacfc64a397d9622320c665 |
|
BLAKE2b-256 | e7e7d48ec756b2b7e9fdfe539447ed277add9cb64ebd09b87097b5378f85b1da |
File details
Details for the file pytest_crayons-0.0.2-py3-none-any.whl
.
File metadata
- Download URL: pytest_crayons-0.0.2-py3-none-any.whl
- Upload date:
- Size: 3.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: python-requests/2.28.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 371a781efd3511cce4d5e119a3095f80db377ec78810446f7455414c480bd7f8 |
|
MD5 | 6353489bd1cb31d39efe69f1098e6ee4 |
|
BLAKE2b-256 | 8647adc3b650ecec5a7543c1889369b18b9d3fa73d15a1d653eef382e7217cb7 |