Skip to main content

A pytest plugin to treat non-assertion failures as test errors.

Project description

pytest-finer-verdicts

A pytest plugin to treat non-assertion failures as test errors.

Getting the plugin

The plugin can be installed via pip install pytest-finer-verdicts. Similarly, it can be uninstalled via pip uninstall pytest-finer-verdicts.

Usage

Consider the following snippet in a file test.py (available as temp/test.py in the repository).

import pytest

def test_pass():
    assert 70 <= 75

def test_fail():
    assert 75 <= 70

def test_error():
    raise RuntimeError()

def test_pytest_fail():
    pytest.fail("Fail")

def test_pytest_raises():
    with pytest.raises(ValueError):
        raise IndexError()

With pytest-finer-verdicts plugin, py.test test.py -v will produce the following output.

collected 5 items

test.py::test_pass PASSED
test.py::test_fail FAILED
test.py::test_error ERROR
test.py::test_pytest_fail FAILED
test.py::test_pytest_raises ERROR

================================== ERRORS ===================================
_______________________ ERROR at setup of test_error ________________________

    def test_error():
>       raise RuntimeError()
E       RuntimeError

test.py:13: RuntimeError
___________________ ERROR at setup of test_pytest_raises ____________________

    def test_pytest_raises():
        with pytest.raises(ValueError):
>           raise IndexError()
E           IndexError

test.py:22: IndexError
================================= FAILURES ==================================
_________________________________ test_fail _________________________________

    def test_fail():
>       assert 75 <= 70
E       assert 75 <= 70

test.py:9: AssertionError
_____________________________ test_pytest_fail ______________________________

    def test_pytest_fail():
>       pytest.fail("Fail")
E       Failed: Fail

test.py:17: Failed
================ 2 failed, 1 passed, 2 error in 0.05 seconds ================

Notice how test_error and test_pytest_raises are flagged as test errors by the plugin.

Attribution

Copyright (c) 2016-2018, Venkatesh-Prasad Ranganath

Licensed under BSD 3-clause “New” or “Revised” License (https://choosealicense.com/licenses/bsd-3-clause/)

Authors: Venkatesh-Prasad Ranganath

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-finer-verdicts-1.0.6.post1.tar.gz (5.0 kB view details)

Uploaded Source

Built Distribution

pytest_finer_verdicts-1.0.6.post1-py2.py3-none-any.whl (4.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file pytest-finer-verdicts-1.0.6.post1.tar.gz.

File metadata

  • Download URL: pytest-finer-verdicts-1.0.6.post1.tar.gz
  • Upload date:
  • Size: 5.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for pytest-finer-verdicts-1.0.6.post1.tar.gz
Algorithm Hash digest
SHA256 cac99bb57aa0d0cf5839d7d1805c48d1fd93f7e1fd86c97c51bf14dafd2b716b
MD5 3ea28943bdc4ed600fad12b8ad378226
BLAKE2b-256 f7696d0ceddd05b63a22067fc6646d92aac185119b4326c71d94f63af5053b64

See more details on using hashes here.

File details

Details for the file pytest_finer_verdicts-1.0.6.post1-py2.py3-none-any.whl.

File metadata

  • Download URL: pytest_finer_verdicts-1.0.6.post1-py2.py3-none-any.whl
  • Upload date:
  • Size: 4.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.2

File hashes

Hashes for pytest_finer_verdicts-1.0.6.post1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 1c987990c825670b95e0055edeff80608828da3dc37379d1979cda6d63fdaa44
MD5 c1f8da84c63cab827bcb3044ae2a0a4d
BLAKE2b-256 c4c05fd859328348ec0053fd9d44acd49851eec07c1501f77c0da03eb7bc5452

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