Skip to main content

A pytest plugin that adds emojis to your test result report

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pytest-emoji-0.2.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

pytest_emoji-0.2.0-py3-none-any.whl (5.7 kB view details)

Uploaded Python 3

File details

Details for the file pytest-emoji-0.2.0.tar.gz.

File metadata

  • Download URL: pytest-emoji-0.2.0.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using 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

File hashes

Hashes for pytest-emoji-0.2.0.tar.gz
Algorithm Hash digest
SHA256 e1bd4790d87649c2d09c272c88bdfc4d37c1cc7c7a46583087d7c510944571e8
MD5 21263d9b1733a09f2de0c36d3af148c7
BLAKE2b-256 884dd489f939f0717a034cea7955d36bc2a7a5ba1b263871e63ad8cb16d47555

See more details on using hashes here.

File details

Details for the file pytest_emoji-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: pytest_emoji-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 5.7 kB
  • Tags: Python 3
  • Uploaded using 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

File hashes

Hashes for pytest_emoji-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 6e34ed21970fa4b80a56ad11417456bd873eb066c02315fe9df0fafe6d4d4436
MD5 bcd9169a33a5a11490b54a3c9b3d61ed
BLAKE2b-256 f75180af966c0aded877da7577d21c4601ca98c6f603c6e6073ddea071af01ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page