Skip to content

Conversation

@hugovk
Copy link
Member

@hugovk hugovk commented Nov 12, 2023

pytest.fail() gives slightly nicer errors:

https://docs.pytest.org/en/7.1.x/reference/reference.html#pytest-fail

import pytest


def test_a():
    assert False


def test_b():
    assert False, "abc"


def test_c():
    pytest.fail()


def test_d():
    pytest.fail("abc")
============================================================================================= FAILURES =============================================================================================
______________________________________________________________________________________________ test_a ______________________________________________________________________________________________

    def test_a():
>       assert False
E       assert False

1.py:5: AssertionError
______________________________________________________________________________________________ test_b ______________________________________________________________________________________________

    def test_b():
>       assert False, "abc"
E       AssertionError: abc
E       assert False

1.py:9: AssertionError
______________________________________________________________________________________________ test_c ______________________________________________________________________________________________

    def test_c():
>       pytest.fail()
E       Failed

1.py:13: Failed
______________________________________________________________________________________________ test_d ______________________________________________________________________________________________

    def test_d():
>       pytest.fail("abc")
E       Failed: abc

1.py:17: Failed
===================================================================================== short test summary info ======================================================================================
FAILED 1.py::test_a - assert False
FAILED 1.py::test_b - AssertionError: abc
FAILED 1.py::test_c - Failed
FAILED 1.py::test_d - Failed: abc
======================================================================================== 4 failed in 0.06s =========================================================================================

@hugovk hugovk added the Testing label Nov 12, 2023
@radarhere radarhere merged commit 25cc5af into python-pillow:main Nov 12, 2023
@hugovk hugovk deleted the pytest-fail branch November 12, 2023 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants