MCPcopy Create free account
hub / github.com/pytest-dev/pytest / test_fail_and_continue_with_stepwise

Function test_fail_and_continue_with_stepwise

testing/test_stepwise.py:114–135  ·  view source on GitHub ↗
(stepwise_pytester: Pytester)

Source from the content-addressed store, hash-verified

112
113
114def test_fail_and_continue_with_stepwise(stepwise_pytester: Pytester) -> None:
115 # Run the tests with a failing second test.
116 result = stepwise_pytester.runpytest(
117 "-v", "--strict-markers", "--stepwise", "--fail"
118 )
119 assert _strip_resource_warnings(result.stderr.lines) == []
120
121 stdout = result.stdout.str()
122 # Make sure we stop after first failing test.
123 assert "test_success_before_fail PASSED" in stdout
124 assert "test_fail_on_flag FAILED" in stdout
125 assert "test_success_after_fail" not in stdout
126
127 # "Fix" the test that failed in the last run and run it again.
128 result = stepwise_pytester.runpytest("-v", "--strict-markers", "--stepwise")
129 assert _strip_resource_warnings(result.stderr.lines) == []
130
131 stdout = result.stdout.str()
132 # Make sure the latest failing test runs and then continues.
133 assert "test_success_before_fail" not in stdout
134 assert "test_fail_on_flag PASSED" in stdout
135 assert "test_success_after_fail PASSED" in stdout
136
137
138@pytest.mark.parametrize("stepwise_skip", ["--stepwise-skip", "--sw-skip"])

Callers

nothing calls this directly

Calls 3

strMethod · 0.80
_strip_resource_warningsFunction · 0.70
runpytestMethod · 0.45

Tested by

no test coverage detected