Name | pytest-crayons JSON |
Version |
0.0.7
JSON |
| download |
home_page | |
Summary | A pytest plugin for colorful print statements |
upload_time | 2023-10-08 22:47:41 |
maintainer | |
docs_url | None |
author | Brian Okken |
requires_python | >=3.7 |
license | The MIT License (MIT) Copyright (c) 2023 Brian Okken Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
keywords |
|
VCS |
|
bugtrack_url |
|
requirements |
No requirements were recorded.
|
Travis-CI |
No Travis.
|
coveralls test coverage |
|
# 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`.
```python
def test_magenta(magenta):
blue("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](https://github.com/okken/pytest-crayons/blob/main/docs/magenta.png?raw=true)
## Available colors
* red
* green
* yellow
* blue
* magenta
* cyan
Example with all colors:
```python
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](https://github.com/okken/pytest-crayons/blob/main/docs/test_example.png?raw=true)
## This was included in a talk for PyCascades 2023
* Conference talk page : [Sharing is Caring - Sharing pytest Fixtures](https://2023.pycascades.com/program/talks/sharing-is-caring-sharing-pytest-fixtures/)
Raw data
{
"_id": null,
"home_page": "",
"name": "pytest-crayons",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "",
"author": "Brian Okken",
"author_email": "",
"download_url": "https://files.pythonhosted.org/packages/f8/7b/f31ff22a5f5d066f57cc055ac282069e87ffe011d1e6c31674d5f5505910/pytest-crayons-0.0.7.tar.gz",
"platform": null,
"description": "# pytest-crayons\n\nA pytest plugin for colorful print statements.\n\n## Installation\n\n```\npip install pytest-crayons\n```\n\n## Usage\n\n1. Include a color fixture in the param list of a test. \n2. Then use it instead of `print`.\n\n```python\ndef test_magenta(magenta):\n blue(\"this should be magenta\")\n```\n\nJust like normal print statements, you only see the output if:\n\n* There's an failure in the test.\n* or you pass in `-s` or `--capture=no`\n* or you wrap the statement in a `with capsys.disabled():` block.\n\nFor our examples, we'll use `-s`:\n\n![output of test_something](https://github.com/okken/pytest-crayons/blob/main/docs/magenta.png?raw=true)\n\n## Available colors\n\n* red \n* green\n* yellow\n* blue\n* magenta\n* cyan\n\nExample with all colors: \n\n```python\ndef test_colors(red, green, yellow, blue, magenta, cyan):\n print(\"\") # for the newline\n red(\"this should be red\")\n green(\"this should be green\")\n yellow(\"this should be yellow\")\n blue(\"this should be blue\")\n magenta(\"this should be magenta\")\n cyan(\"this should be cyan\")\n```\n\n![output of test_colors](https://github.com/okken/pytest-crayons/blob/main/docs/test_example.png?raw=true)\n\n## This was included in a talk for PyCascades 2023\n\n* Conference talk page : [Sharing is Caring - Sharing pytest Fixtures](https://2023.pycascades.com/program/talks/sharing-is-caring-sharing-pytest-fixtures/)\n",
"bugtrack_url": null,
"license": "The MIT License (MIT) Copyright (c) 2023 Brian Okken Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
"summary": "A pytest plugin for colorful print statements",
"version": "0.0.7",
"project_urls": {
"Home": "https://github.com/okken/pytest-crayons"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "2f747d5544154d496b506384abc8dd7fbae9de528b92b05ee9819515769390b9",
"md5": "2ec7a59d1be5b3977d78c532eb0f614a",
"sha256": "f33b6ce9e45a7c41dd54790b8161448df2a51b24090a66fd83e147e8496b95da"
},
"downloads": -1,
"filename": "pytest_crayons-0.0.7-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2ec7a59d1be5b3977d78c532eb0f614a",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 3963,
"upload_time": "2023-10-08T22:47:40",
"upload_time_iso_8601": "2023-10-08T22:47:40.114102Z",
"url": "https://files.pythonhosted.org/packages/2f/74/7d5544154d496b506384abc8dd7fbae9de528b92b05ee9819515769390b9/pytest_crayons-0.0.7-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "f87bf31ff22a5f5d066f57cc055ac282069e87ffe011d1e6c31674d5f5505910",
"md5": "d8d01df51387a4916186948102b3c167",
"sha256": "c1f1c13c00a4b71005f67ae6605c6f44019c961372f78e622bcfbe8a7229ed9c"
},
"downloads": -1,
"filename": "pytest-crayons-0.0.7.tar.gz",
"has_sig": false,
"md5_digest": "d8d01df51387a4916186948102b3c167",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.7",
"size": 93336,
"upload_time": "2023-10-08T22:47:41",
"upload_time_iso_8601": "2023-10-08T22:47:41.695812Z",
"url": "https://files.pythonhosted.org/packages/f8/7b/f31ff22a5f5d066f57cc055ac282069e87ffe011d1e6c31674d5f5505910/pytest-crayons-0.0.7.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2023-10-08 22:47:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "okken",
"github_project": "pytest-crayons",
"travis_ci": false,
"coveralls": true,
"github_actions": true,
"tox": true,
"lcname": "pytest-crayons"
}