Skip to main content

pytest-emoji

A pytest plugin that adds emojis to your test result report 😍

pytest

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. 🍪

Installation

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.

Features

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 😡

Customization

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.

Community

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.

Issues

If you encounter any problems, please file an issue along with a detailed description.

License

Distributed under the terms of the MIT license, pytest-emoji is free and open source software

Metadata

Release files for pytest-emoji 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pytest-emoji 0.2.0
File Size Uploaded Provenance
pytest-emoji-0.2.0.tar.gz 6.2 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for pytest-emoji 0.2.0
File Interpreter ABI Platform
pytest_emoji-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 11.8 kB

Release files / pytest-emoji-0.2.0.tar.gz

Download URL pytest-emoji-0.2.0.tar.gz
Size 6.2 kB
Tags Source
SHA-256 checksum
How to use checksums
e1bd4790d87649c2d09c272c88bdfc4d37c1cc7c7a46583087d7c510944571e8
BLAKE2b-256 checksum
How to use checksums
884dd489f939f0717a034cea7955d36bc2a7a5ba1b263871e63ad8cb16d47555
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Release files / pytest_emoji-0.2.0-py3-none-any.whl

Download URL pytest_emoji-0.2.0-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6e34ed21970fa4b80a56ad11417456bd873eb066c02315fe9df0fafe6d4d4436
BLAKE2b-256 checksum
How to use checksums
f75180af966c0aded877da7577d21c4601ca98c6f603c6e6073ddea071af01ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

Security for pytest-emoji 0.2.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page