pytest-emoji
pytest-emoji is a pytest plugin that enhances your test result reports by replacing standard indicators with expressive emojis. It offers clear visual feedback for passed, failed, skipped, xfailed, xpassed, and error states, making test output more engaging and easier to parse at a glance. The plugin is currently at version 0.2.0 and maintains a steady cadence as part of the pytest ecosystem.
Common errors
-
Emojis not appearing in test report output
cause The `--emoji` command-line flag was not provided when running pytest.fixRun pytest with the `--emoji` flag: `pytest --emoji` (for normal output) or `pytest --verbose --emoji` (for verbose output). -
Custom `pytest_emoji_*` hooks in `conftest.py` raise `AttributeError` or other unexpected behavior related to `pytest.config` after `pytest-emoji` upgrade.
cause Your `conftest.py` might be attempting to access the global `pytest.config` object, which is no longer recommended and may lead to issues after `pytest-emoji` v0.2.0's internal changes.fixUpdate your custom `pytest_emoji_*` hooks to accept the `config` object as an argument and use that for configuration access. For example, change `def pytest_emoji_passed(): ...` to `def pytest_emoji_passed(config): ...`.
Warnings
- breaking The global `pytest.config` object is deprecated for direct access within plugin hooks. Version 0.2.0 of `pytest-emoji` no longer uses it internally.
- gotcha Emojis might not display correctly in all terminal environments or on certain operating systems (e.g., older Windows consoles) due to font or encoding limitations.
Install
-
pip install pytest-emoji
Quickstart
# my_test_file.py
def test_pass():
assert True
def test_fail():
assert False
# Run from your terminal:
# pytest --emoji my_test_file.py
# You should see:
# my_test_file.py ๐ ๐ฐ