Run a fixture and its teardown
A yield fixture separates setup from teardown around the test that requests it. Code before yield prepares a resource; code after yield releases it. Pytest owns that lifetime, so test code does not need to remember a manual cleanup call.
This exercise writes a real test module into a temporary directory and invokes pytest on it. An audit file records the order of events. That checks actual fixture execution instead of merely reading a decorator. Plugin auto-loading is disabled for the isolated run so unrelated host configuration cannot change the demonstration.
import pytest
@pytest.fixture
def items():
values = []
yield values
values.clear()
print(items.__name__)Your task
Implement fixture_lifecycle() using a real pytest run in a temporary folder. A yield fixture records "open", its test records "body", and teardown records "close". Return (exit_code,event_list). No state may leak between calls.
The explanation opens here once every check passes.