Capture and verify printed output using capsys in pytest
Preconditions (2)
Step 1: Write a Python function that prints 'Hello, world!'
Step 2: Write a pytest test function that calls the print function
Step 3: Use the capsys fixture to capture the printed output
Step 4: Assert that the captured output matches 'Hello, world!\n'
✅ Expected Result: The test passes confirming the printed output is correctly captured and matches the expected string