Test Overview
This test verifies that pytest runs with default options specified in the pytest.ini file using the addopts setting. It checks that verbose output is enabled by default due to -v from addopts.
This test verifies that pytest runs with default options specified in the pytest.ini file using the addopts setting. It checks that verbose output is enabled by default due to -v from addopts.
import subprocess def test_pytest_addopts_default(): # Run pytest with no extra options, relying on addopts in pytest.ini result = subprocess.run(['pytest', 'test_sample.py'], capture_output=True, text=True) # Check that verbose output is present due to -v from addopts assert "::" in result.stdout assert result.returncode == 0
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Test runner starts subprocess to run 'pytest test_sample.py' without extra options | Command line runs pytest with default options from pytest.ini addopts | - | PASS |
| 2 | Pytest loads configuration and applies addopts '-v' for verbose output | Pytest runs tests with verbose output enabled | - | PASS |
| 3 | Test subprocess completes and returns output | Captured stdout includes verbose test names and statuses | Check that '::' is in stdout (verbose indicator) and return code is 0 | PASS |