Test resource setup and cleanup using a context manager fixture
Preconditions (2)
Step 1: Create a pytest fixture using the @pytest.fixture decorator with yield to act as a context manager
Step 2: In the fixture, set up a resource before the yield statement
Step 3: After the yield statement, clean up the resource
Step 4: Write a test function that uses this fixture as a parameter
Step 5: Inside the test, verify the resource is set up correctly
Step 6: Run the test using pytest
✅ Expected Result: The test passes, confirming the resource was set up before the test and cleaned up after the test