pytest-assume
pytest-assume copied to clipboard
Tests are passing when there is a Fail inside pytest.assume in the teardown
Tests are passing when there is a Fail inside pytest.assume
in the teardown. Also, when not using pytest.assume
, only the last test is failing.
test code:
import pytest
@pytest.fixture(scope='module')
def fixt_1():
yield
with pytest.assume:
assert False
@pytest.mark.parametrize('x', (1, 2))
def test_1(fixt_1, x):
pass
@pytest.fixture(scope='module')
def fixt_2():
yield
assert False
@pytest.mark.parametrize('x', (10, 20))
def test_2(fixt_2, x):
pass
That is expected. We only hook into runtest_call
, not fixture setup/teardown.
I am facing the same issue. I want to use assume in teardown to record error without breaking the teardown process.
One side effect is that the assume recorded in teardown is being reported in the next test !