Closed
Description
My test looks like this.
import pytest
@pytest.fixture
def foo():
yield
print("foo")
raise ValueError("foo")
@pytest.fixture
def bar():
yield
print("bar")
raise ValueError("foo")
def test_foo(foo, bar):
pass
And it gives me this output:
======================= test session starts =======================
platform linux -- Python 3.6.9[pypy-7.3.1-final], pytest-6.0.1, py-1.9.0, pluggy-0.13.0
rootdir: /home/ppodusowski/Playground/pytest-fixtures
plugins: asyncio-0.14.0, flakefinder-1.0.0, timeout-1.4.2
collected 1 item
test_foo.py .E [100%]
============================= ERRORS ==============================
__________________ ERROR at teardown of test_foo __________________
@pytest.fixture
def bar():
yield
print("bar")
> raise ValueError("foo")
E ValueError: foo
test_foo.py:13: ValueError
-------------------- Captured stdout teardown ---------------------
bar
foo
===================== short test summary info =====================
ERROR test_foo.py::test_foo - ValueError: foo
=================== 1 passed, 1 error in 0.26s ====================
So despite both finalizers being called, exception from only one of them is reported. Apparently the issue is known.
Metadata
Metadata
Assignees
Labels
No labels