Test Overview
This test demonstrates how to skip a test in pytest with a clear reason. It verifies that the test is not executed and is reported as skipped.
This test demonstrates how to skip a test in pytest with a clear reason. It verifies that the test is not executed and is reported as skipped.
import pytest @pytest.mark.skip(reason="Skipping this test because feature is under development") def test_feature_under_development(): assert False, "This should not run" def test_always_passes(): assert True
| Step | Action | System State | Assertion | Result |
|---|---|---|---|---|
| 1 | Pytest starts test run | Test suite loaded with two tests: one skipped, one normal | - | PASS |
| 2 | Pytest identifies test_feature_under_development is marked with @pytest.mark.skip | Test runner skips execution of test_feature_under_development | Test is skipped with reason 'Skipping this test because feature is under development' | PASS |
| 3 | Pytest executes test_always_passes normally | Test runs and completes without errors | Assert True passes | PASS |
| 4 | Pytest finishes test run and reports results | Test report shows one skipped test with reason and one passed test | Skipped test reason is displayed in report | PASS |