pax_global_header00006660000000000000000000000064134327451240014517gustar00rootroot0000000000000052 comment=f323d299a95a71d47c007b208568be6c9cffdaa8 pytest-emoji-0.2.0/000077500000000000000000000000001343274512400141475ustar00rootroot00000000000000pytest-emoji-0.2.0/.gitignore000066400000000000000000000020341343274512400161360ustar00rootroot00000000000000# Byte-compiled / optimized / DLL files __pycache__/ *.py[cod] *$py.class # C extensions *.so # Distribution / packaging .Python env/ build/ develop-eggs/ dist/ downloads/ eggs/ .eggs/ lib/ lib64/ parts/ sdist/ var/ *.egg-info/ .installed.cfg *.egg # PyInstaller # Usually these files are written by a python script from a template # before PyInstaller builds the exe, so as to inject date/other infos into it. *.manifest *.spec # Installer logs pip-log.txt pip-delete-this-directory.txt # Unit test / coverage reports htmlcov/ .tox/ .coverage .coverage.* .cache nosetests.xml coverage.xml *,cover .hypothesis/ # Translations *.mo *.pot # Django stuff: *.log local_settings.py # Flask stuff: instance/ .webassets-cache # Scrapy stuff: .scrapy # Sphinx documentation docs/_build/ # PyBuilder target/ # IPython Notebook .ipynb_checkpoints # pyenv .python-version # celery beat schedule file celerybeat-schedule # dotenv .env # virtualenv .venv/ venv/ ENV/ # Spyder project settings .spyderproject # Rope project settings .ropeproject pytest-emoji-0.2.0/.travis.yml000066400000000000000000000005641343274512400162650ustar00rootroot00000000000000dist: xenial language: python cache: directories: - $HOME/.cache/pip matrix: include: - python: 3.4 env: TOXENV=py34 - python: 3.5 env: TOXENV=py35 - python: 3.6 env: TOXENV=py36 - python: 3.7 env: TOXENV=py37 - python: 3.7 env: TOXENV=flake8 install: - pip install tox script: - tox pytest-emoji-0.2.0/CONTRIBUTORS.md000066400000000000000000000002321343274512400164230ustar00rootroot00000000000000# Contributors - Brian Okken ([@okken]) - Raphael Pierzina ([@hackebrot]) [@hackebrot]: https://github.com/hackebrot [@okken]: https://github.com/okken pytest-emoji-0.2.0/LICENSE000066400000000000000000000020741343274512400151570ustar00rootroot00000000000000 The MIT License (MIT) Copyright (c) 2016 Raphael Pierzina Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. pytest-emoji-0.2.0/MANIFEST.in000066400000000000000000000001721343274512400157050ustar00rootroot00000000000000include LICENSE include README.md recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] pytest-emoji-0.2.0/Makefile000066400000000000000000000007121343274512400156070ustar00rootroot00000000000000.PHONY: clean-tox clean-build clean-py help: @echo "clean-build - remove build artifacts" @echo "clean-py - remove Python file artifacts" @echo "clean-tox - remove tox file artifacts" @echo "clean - remove all file artifacts" clean: clean-tox clean-build clean-py clean-tox: rm -rf .tox/ clean-build: rm -rf build/ rm -rf dist/ rm -rf src/*.egg-info clean-py: find . -type f -name "*.py[co]" -delete find . -type d -name "__pycache__" -delete pytest-emoji-0.2.0/README.md000066400000000000000000000100171343274512400154250ustar00rootroot00000000000000# 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][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][cookiecutter] along with [@hackebrot][hackebrot]'s [cookiecutter-pytest-plugin][plugin-template] template. 🍪 [cookiecutter]: https://github.com/audreyr/cookiecutter [hackebrot]: https://github.com/hackebrot [pytest]: https://github.com/pytest-dev/pytest [plugin-template]: https://github.com/pytest-dev/cookiecutter-pytest-plugin ## Installation **pytest-emoji** is available for Python 3. 🐍 You can install **pytest-emoji** via [pip][pip] from [PyPI][PyPI]: ```text $ pip install pytest-emoji ``` This will automatically install **pytest** of version 4.2.1 or higher. [pip]: https://pypi.python.org/pypi/pip/ [PyPI]: https://pypi.org/project/pytest-emoji/ ## 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: ```text $ pytest --emoji ``` ```text tests/test_emoji.py 😃 😰 😞 😲 🙄 😡 ``` Verbose mode: ```text $ pytest --verbose --emoji ``` ```text 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. ```python 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 ``("", "")``. 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][coc]. [coc]: https://www.pypa.io/en/latest/code-of-conduct/ ## Issues If you encounter any problems, please [file an issue][issues] along with a detailed description. [issues]: https://github.com/hackebrot/pytest-emoji/issues ## License Distributed under the terms of the [MIT][mit] license, **pytest-emoji** is free and open source software [mit]: http://opensource.org/licenses/MIT pytest-emoji-0.2.0/appveyor.yml000066400000000000000000000012021343274512400165320ustar00rootroot00000000000000# What Python version is installed where: # http://www.appveyor.com/docs/installed-software#python environment: matrix: - PYTHON: "C:\\Python34" TOX_ENV: "py34" - PYTHON: "C:\\Python35" TOX_ENV: "py35" - PYTHON: "C:\\Python36" TOX_ENV: "py36" - PYTHON: "C:\\Python37" TOX_ENV: "py37" init: - "%PYTHON%/python -V" - "%PYTHON%/python -c \"import struct;print( 8 * struct.calcsize(\'P\'))\"" install: - "%PYTHON%/Scripts/easy_install -U pip" - "%PYTHON%/Scripts/pip install tox" - "%PYTHON%/Scripts/pip install wheel" build: false test_script: - "%PYTHON%/Scripts/tox -e %TOX_ENV%" pytest-emoji-0.2.0/docs/000077500000000000000000000000001343274512400150775ustar00rootroot00000000000000pytest-emoji-0.2.0/docs/index.md000066400000000000000000000001341343274512400165260ustar00rootroot00000000000000# Welcome to pytest-emoji A pytest plugin that adds emojis to your test result report 😍 pytest-emoji-0.2.0/labels.toml000066400000000000000000000020711343274512400163060ustar00rootroot00000000000000[bug] color = "ea707a" description = "Bugs and problems with pytest-emoji" name = "bug" ["code quality"] color = "fcc4db" description = "Tasks related to linting, coding style, type checks" name = "code quality" [dependencies] color = "43a2b7" description = "Tasks related to managing dependencies" name = "dependencies" [discussion] color = "8f7ad6" description = "Issues for discussing ideas for features" name = "discussion" ["do not merge"] color = "e069aa" description = "Pull requests which must not be merged" name = "do not merge" [docs] color = "2abf88" description = "Tasks to write and update documentation" name = "docs" [enhancement] color = "81c4e2" description = "New feature or enhancement for pytest-emoji" name = "enhancement" ["good first issue"] color = "b6f4a1" description = "Tasks to pick up by newcomers to pyest-emoji" name = "good first issue" [misc] color = "f9d03b" description = "Tasks that don't fit any of the other categories" name = "misc" [project] color = "bbd1f7" description = "Tasks related to managing pytest-emoji" name = "project" pytest-emoji-0.2.0/mkdocs.yml000066400000000000000000000003461343274512400161550ustar00rootroot00000000000000site_name: pytest-emoji site_description: A pytest plugin that adds emojis to your test result report site_author: Raphael Pierzina theme: readthedocs repo_url: https://github.com/hackebrot/pytest-emoji pages: - Home: index.md pytest-emoji-0.2.0/setup.cfg000066400000000000000000000001011343274512400157600ustar00rootroot00000000000000[metadata] license_file = LICENSE [flake8] max-line-length = 88 pytest-emoji-0.2.0/setup.py000066400000000000000000000030621343274512400156620ustar00rootroot00000000000000import pathlib import setuptools def read(*args): file_path = pathlib.Path(__file__).parent.joinpath(*args) with file_path.open(encoding="utf-8") as f: return f.read() setuptools.setup( name="pytest-emoji", version="0.2.0", author="Raphael Pierzina", author_email="raphael@hackebrot.de", maintainer="Raphael Pierzina", maintainer_email="raphael@hackebrot.de", license="MIT", url="https://github.com/hackebrot/pytest-emoji", description="A pytest plugin that adds emojis to your test result report", long_description=read("README.md"), long_description_content_type="text/markdown", packages=setuptools.find_packages("src"), package_dir={"": "src"}, include_package_data=True, zip_safe=False, python_requires=">=3.4", install_requires=["pytest>=4.2.1"], classifiers=[ "Development Status :: 4 - Beta", "Framework :: Pytest", "Intended Audience :: Developers", "Topic :: Software Development :: Testing", "Programming Language :: Python", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Programming Language :: Python :: 3.7", "Programming Language :: Python :: Implementation :: CPython", "Operating System :: OS Independent", "License :: OSI Approved :: MIT License", ], entry_points={"pytest11": ["emoji = pytest_emoji.plugin"]}, keywords=["pytest", "emoji"], ) pytest-emoji-0.2.0/src/000077500000000000000000000000001343274512400147365ustar00rootroot00000000000000pytest-emoji-0.2.0/src/pytest_emoji/000077500000000000000000000000001343274512400174515ustar00rootroot00000000000000pytest-emoji-0.2.0/src/pytest_emoji/__init__.py000066400000000000000000000000001343274512400215500ustar00rootroot00000000000000pytest-emoji-0.2.0/src/pytest_emoji/hooks.py000066400000000000000000000026271343274512400211550ustar00rootroot00000000000000import pytest @pytest.hookspec(firstresult=True) def pytest_emoji_passed(config): """Called to get a representation for a passed test item. Requires a tuple of (, ) pytest defaults to ('.', 'PASSED') """ @pytest.hookspec(firstresult=True) def pytest_emoji_failed(config): """Called to get a representation for a failed test item. Requires a tuple of (, ) pytest defaults to ('F', 'FAILED') """ @pytest.hookspec(firstresult=True) def pytest_emoji_skipped(config): """Called to get a representation for a skipped test item. Requires a tuple of (, ) pytest default to ('s', 'SKIPPED') """ @pytest.hookspec(firstresult=True) def pytest_emoji_error(config): """Called to get a representation for a error test item. Requires a tuple of (, ) pytest defaults to ('E', 'ERROR') """ @pytest.hookspec(firstresult=True) def pytest_emoji_xfailed(config): """Called to get a representation for a xfailed test item. Requires a tuple of (, ) pytest defaults to ('x', 'XFAIL') """ @pytest.hookspec(firstresult=True) def pytest_emoji_xpassed(config): """Called to get a representation for a xpassed test item. Requires a tuple of (, ) pytest defaults to ('X', 'XPASS') """ pytest-emoji-0.2.0/src/pytest_emoji/plugin.py000066400000000000000000000045411343274512400213250ustar00rootroot00000000000000from pytest_emoji import hooks def pytest_emoji_passed(config): # SMILING FACE WITH OPEN MOUTH return u"😃 ", u"PASSED 😃 " def pytest_emoji_failed(config): # FACE WITH OPEN MOUTH AND COLD SWEAT return u"😰 ", u"FAILED 😰 " def pytest_emoji_skipped(config): # FACE WITH ROLLING EYES return u"🙄 ", u"SKIPPED 🙄 " def pytest_emoji_error(config): # POUTING FACE return u"😡 ", u"ERROR 😡 " def pytest_emoji_xfailed(config): # DISAPPOINTED FACE return u"😞 ", u"XFAIL 😞 " def pytest_emoji_xpassed(config): # DIZZY FACE return u"😲 ", u"XPASS 😲 " def pytest_addhooks(pluginmanager): # Register new hooks from pytest_emoji.hooks pluginmanager.add_hookspecs(hooks) def pytest_report_teststatus(report, config): if config.option.emoji is False: # Do not modify reporting, unless pytest is called with --emoji return # Handle error and skipped in setup and teardown phase if report.when in ("setup", "teardown"): if report.failed: short, verbose = config.hook.pytest_emoji_error(config=config) return "error", short, verbose elif report.skipped: short, verbose = config.hook.pytest_emoji_skipped(config=config) return "skipped", short, verbose # Handle xfailed and xpassed if hasattr(report, "wasxfail"): if report.skipped: short, verbose = config.hook.pytest_emoji_xfailed(config=config) return "xfailed", short, verbose elif report.passed: short, verbose = config.hook.pytest_emoji_xpassed(config=config) return "xpassed", short, verbose else: return "", "", "" # Handle passed, skipped and failed in call phase if report.when == "call": if report.passed: short, verbose = config.hook.pytest_emoji_passed(config=config) elif report.skipped: short, verbose = config.hook.pytest_emoji_skipped(config=config) elif report.failed: short, verbose = config.hook.pytest_emoji_failed(config=config) return report.outcome, short, verbose def pytest_addoption(parser): group = parser.getgroup("emoji") group.addoption( "--emoji", action="store_true", default=False, help="Add emojis to the test result log.", ) pytest-emoji-0.2.0/tests/000077500000000000000000000000001343274512400153115ustar00rootroot00000000000000pytest-emoji-0.2.0/tests/conftest.py000066400000000000000000000026641343274512400175200ustar00rootroot00000000000000import textwrap import pytest pytest_plugins = "pytester" @pytest.fixture(name="emoji_tests") def fixture_emoji_tests(): return textwrap.dedent( """\ import pytest def test_passed(): assert "emoji" == "emoji" def test_failed(): assert "emoji" == "hello world" @pytest.mark.xfail def test_xfailed(): assert 1234 == 100 @pytest.mark.xfail def test_xpassed(): assert 1234 == 1234 @pytest.mark.skipif(True, reason="don't run this test") def test_skipped(): assert "emoji" == "emoji" @pytest.fixture def name(): raise RuntimeError @pytest.mark.hello def test_error(name): assert name == "hello" """ ) @pytest.fixture(name="custom_emojis") def fixture_custom_emojis(): return textwrap.dedent( """\ 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 😜 " """ ) pytest-emoji-0.2.0/tests/test_emoji.py000066400000000000000000000074071343274512400200350ustar00rootroot00000000000000def test_emoji_disabled_by_default_verbose(testdir, emoji_tests): # create a temporary pytest test module testdir.makepyfile(emoji_tests) # run pytest with the following cmd args result = testdir.runpytest("-v", "-o", "console_output_style=classic") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "*::test_passed PASSED", "*::test_failed FAILED", "*::test_xfailed XFAIL", "*::test_xpassed XPASS", "*::test_skipped SKIPPED", "*::test_error ERROR", ] ) # make sure that that we get a '1' exit code # as we have at least one failure assert result.ret == 1 def test_emoji_enabled_verbose(testdir, emoji_tests): # create a temporary pytest test module testdir.makepyfile(emoji_tests) # run pytest with the following cmd args result = testdir.runpytest( "-v", "--emoji", "-o", "console_output_style=classic" ) # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "*::test_passed PASSED 😃 ", "*::test_failed FAILED 😰 ", "*::test_xfailed XFAIL 😞 ", "*::test_xpassed XPASS 😲 ", "*::test_skipped SKIPPED 🙄 ", "*::test_error ERROR 😡 ", ] ) # make sure that that we get a '1' exit code # as we have at least one failure assert result.ret == 1 def test_emoji_enabled_custom_verbose(testdir, emoji_tests, custom_emojis): testdir.makeconftest(custom_emojis) # create a temporary pytest test module testdir.makepyfile(emoji_tests) # run pytest with the following cmd args result = testdir.runpytest( "-v", "--emoji", "-o", "console_output_style=classic" ) # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines( [ "*::test_passed PASSED 🍪 ", "*::test_failed FAILED 😿 ", "*::test_xfailed XFAIL 🤓 ", "*::test_xpassed XPASS 😜 ", "*::test_skipped SKIPPED 🙈 ", "*::test_error ERROR 💩 ", ] ) # make sure that that we get a '1' exit code # as we have at least one failure assert result.ret == 1 def test_emoji_disabled_by_default_non_verbose(testdir, emoji_tests): # create a temporary pytest test module testdir.makepyfile(emoji_tests) # run pytest with the following cmd args result = testdir.runpytest("-o", "console_output_style=classic") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines(["* .FxXsE"]) # make sure that that we get a '1' exit code # as we have at least one failure assert result.ret == 1 def test_emoji_enabled_non_verbose(testdir, emoji_tests): # create a temporary pytest test module testdir.makepyfile(emoji_tests) # run pytest with the following cmd args result = testdir.runpytest("--emoji", "-o", "console_output_style=classic") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines(["* 😃 😰 😞 😲 🙄 😡 "]) # make sure that that we get a '1' exit code # as we have at least one failure assert result.ret == 1 def test_emoji_enabled_custom_non_verbose(testdir, emoji_tests, custom_emojis): testdir.makeconftest(custom_emojis) # create a temporary pytest test module testdir.makepyfile(emoji_tests) # run pytest with the following cmd args result = testdir.runpytest("--emoji", "-o", "console_output_style=classic") # fnmatch_lines does an assertion internally result.stdout.fnmatch_lines(["* 🍪 😿 🤓 😜 🙈 💩 "]) # make sure that that we get a '1' exit code # as we have at least one failure assert result.ret == 1 pytest-emoji-0.2.0/tox.ini000066400000000000000000000003751343274512400154670ustar00rootroot00000000000000# For more information about tox, see https://tox.readthedocs.io/en/latest/ [tox] envlist = py34,py35,py36,py37,flake8 [testenv] commands = pytest {posargs:tests} [testenv:flake8] skip_install = true deps = flake8 commands = flake8 src setup.py tests