A pytest plugin that adds emojis to your test result report π
pytest is a mature testing framework for Python that is developed by a thriving community of volunteers. It uses plain assert statements and regular Python comparisons. Writing tests with pytest requires little to no boilerplate code and powerful features allow easy parametrization and intelligent test selection.
There are hundreds of plugins available for pytest with which you can extend and customize your testing harness. Distributed under the terms of the MIT license, pytest is free and open source software.
Check out pytest if you haven't already and if you're not sold just yet, install this plugin. Maybe that will get you motivated to write more tests! π
This pytest plugin was generated with Cookiecutter along with @hackebrot's cookiecutter-pytest-plugin template. πͺ
pytest-emoji is available for Python 3. π
You can install pytest-emoji via pip from PyPI:
$ pip install pytest-emoji
This will automatically install pytest of version 4.2.1 or higher.
This plugin adds a --emoji
CLI flag to pytest, which replaces the test
result indicator to emojis, both for normal and verbose mode.
π / PASSED π
for passed testsπ° / FAILED π°
for failed testsπ / XFAIL π
for xfailed testsπ² / XPASS π²
for xpassed testsπ / SKIPPED π
for skipped testsπ‘ / ERROR π‘
for tests with errors
Normal mode:
$ pytest --emoji
tests/test_emoji.py π π° π π² π π‘
Verbose mode:
$ pytest --verbose --emoji
tests/test_emoji.py::test_passed PASSED π
tests/test_emoji.py::test_failed FAILED π°
tests/test_emoji.py::test_xfailed XFAIL π
tests/test_emoji.py::test_xpassed XPASS π²
tests/test_emoji.py::test_skipped SKIPPED π
tests/test_emoji.py::test_error ERROR π‘
You can also change the emojis, if you want. π
Add a conftest.py
to your tests folder and implement the following hooks.
If you wish to use the default, omit the according hook.
def pytest_emoji_passed(config):
return "πͺ ", "PASSED πͺ "
def pytest_emoji_failed(config):
return "πΏ ", "FAILED πΏ "
def pytest_emoji_skipped(config):
return "π ", "SKIPPED π "
def pytest_emoji_error(config):
return "π© ", "ERROR π© "
def pytest_emoji_xfailed(config):
return "π€ ", "XFAIL π€ "
def pytest_emoji_xpassed(config):
return "π ", "XPASS π "
Naming the hooks correctly is important, make sure you don't make any typos
All of these hooks receive the pytest config
object, which allows you to
check options and further customize the output. All hooks need to return a
tuple of str
as in ("<shortletter>", "<verbose-word>")
.
It's recommended for emoji to add an extra " "
(blank) for better formatting.
Are you interested in contributing to pytest-emoji? Your contributions are greatly appreciated! Every little bit helps, and credit will always be given!
Everyone interacting in the pytest-emoji project's codebases, issue trackers, chat rooms, and mailing lists is expected to follow the PyPA Code of Conduct.
If you encounter any problems, please file an issue along with a detailed description.
Distributed under the terms of the MIT license, pytest-emoji is free and open source software