When a test fails, I wish to print information about my setup in the teardown. However, I cannot see the output in Pycharm in the failing test case after teardown. However, I see the print in the setup.
What to do to see the print in the teardown?
Minimal example:
my_test.py
import pytest
@pytest.mark.parametrize("number_a", [1, 2, 3, 4, 5, 6, 7])
def test_a_low_numbers(number_a):
run_test(number_a=number_a)
def run_test(number_a):
assert number_a != 4
conftest.py
@pytest.fixture(autouse=True, scope="function")
def signal_handler(request, number_a):
print("########Setup")
yield
print("########Teardown information is now printed")
