GithubHelp home page GithubHelp logo

kenmclennan / pytest-emoji Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hackebrot/pytest-emoji

0.0 0.0 0.0 16 KB

pytest + emoji == :heart_eyes:

License: MIT License

Makefile 4.00% Python 96.00%

pytest-emoji's Introduction

pytest-emoji

PyPI Package PyPI Python Versions PyPI Package License See Build Status on Travis CI See Build Status on AppVeyor

pytest + emoji == ๐Ÿ˜

Do you find writing tests tedious or boring? It can be - but it doesn't need to be.

pytest

pytest is a mature testing framework for Python that is developed by a thriving and ever-growing 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.

It can be easily extended and has hundreds of plugins available. 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 ๐Ÿ˜

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 3.0.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 u'๐Ÿช ', u'PASSED ๐Ÿช '


def pytest_emoji_failed(config):
    return u'๐Ÿ˜ฟ ', u'FAILED ๐Ÿ˜ฟ '


def pytest_emoji_skipped(config):
    return u'๐Ÿ™ˆ ', u'SKIPPED ๐Ÿ™ˆ '


def pytest_emoji_error(config):
    return u'๐Ÿ’ฉ ', u'ERROR ๐Ÿ’ฉ '


def pytest_emoji_xfailed(config):
    return u'๐Ÿค“ ', u'xfail ๐Ÿค“ '


def pytest_emoji_xpassed(config):
    return u'๐Ÿ˜œ ', u'XPASS ๐Ÿ˜œ '

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

Contributing

Contributions are very welcome. Tests can be run with tox.

License

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

Issues

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

Code of Conduct

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.

pytest-emoji's People

Contributors

hackebrot avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.