Configure the symbols displayed for test outcomes
Project description
pytest-custom-report
A plugin for defining your own characters to be used when displaying test outcomes in pytest (passed, failed, skipped etc).
For example, if you wanted to see a PILE OF POO (U+1F4A9) glyph displayed in the terminal report for each failing test:
pytest --report-failed=💩
To persist your custom characters, add a section like this in the configuration file (i.e. in pytest.ini, tox.ini, setup.cfg or whatever):
[pytest]
report_failed = 💩
report_failed_verbose = OH CRAP
Installation and Usage
pip install pytest-custom-report
This will add new command-line arguments and configuration file options to pytest (detailed in the following section). Command line arguments take precedence over configuration file settings. The plugin is always enabled, but unless you’ve configured your own symbols the pytest defaults are used.
To execute tests with the plugin disabled temporarily, use this:
pytest -p no:pytest-custom-report
If you’re trying to use emojis but you can’t see the glyphs properly in your terminal, you may be missing unicode fonts with the upper plane - you could install for example GNU Unifont.
Configuration
The table below shows the available options as well as pytest’s default style for each outcome.
test outcome |
command-line argument name |
.ini file config key |
default report symbol |
---|---|---|---|
passed |
--report-passed |
report_passed |
. |
xpassed |
--report-xpassed |
report_xpassed |
X |
failed |
--report-failed |
report_failed |
F |
xfailed |
--report-xfailed |
report_xfailed |
x |
skipped |
--report-skipped |
report_skipped |
s |
error |
--report-error |
report_error |
E |
When tests are executed with -v or --verbose flag enabled, you’ll see longer strings displayed and one-line per test outcome. These can be specified too.
test outcome |
command-line argument name |
.ini file config key |
default report string |
---|---|---|---|
passed |
--report-passed-verbose |
report_passed_verbose |
PASSED |
xpassed |
--report-xpassed-verbose |
report_xpassed_verbose |
XPASS |
failed |
--report-failed-verbose |
report_failed_verbose |
FAILED |
xfailed |
--report-xfailed-verbose |
report_xfailed_verbose |
XFAIL |
skipped |
--report-skipped-verbose |
report_skipped_verbose |
SKIPPED |
error |
--report-error-verbose |
report_error_verbose |
ERROR |
Example config file
Here is some example pytest.ini content that you can copy-paste and modify to your liking:
[pytest]
report_passed = ✔
report_xpassed = 🦄
report_failed = ✗
report_xfailed = 👎
report_skipped = ?
report_error = 🔥
report_passed_verbose = OH YEAH
report_xpassed_verbose = WHAT IN TARNATION?
report_failed_verbose = OH CRAP
report_xfailed_verbose = YEAH WHATEVER
report_skipped_verbose = DON'T CARE
report_error_verbose = YOU MEDDLING KIDS!
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 Distributions
Built Distribution
Hashes for pytest_custom_report-1.0.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f048c5a06faf1621099a27571f4d749a666e8bfc038e158e10f17775add27364 |
|
MD5 | 85e24eb1c89d8564015213af311f75a3 |
|
BLAKE2b-256 | 649aa2d1e9173c8ed7df06de8a50b1c526b0b3a912c5925c153e46e3da69d7d8 |