With this code:
import pytest
@pytest.yield_fixture
def fixt():
yield
raise Exception
def test_foo(fixt):
pass
We get this output:
collected 1 items
py/test_foo.py::test_foo PASSED
py/test_foo.py::test_foo ERROR
================================== ERRORS ===================================
_______________________ ERROR at teardown of test_foo _______________________
@pytest.yield_fixture
def fixt():
yield
> raise Exception
E Exception
py/test_foo.py:6: Exception
===================== 1 passed, 1 error in 0.41 seconds ====================
The test obviously only should be listed once, and no passed tests should be listed.
With this code:
We get this output:
The test obviously only should be listed once, and no passed tests should be listed.