Skip to content

Commit 831d061

Browse files
authored
Docs: be more precise about TestReport outcome in example (#12535)
* Testing only for "failed" should not be reported as "or skipped" * Test for "skipped" explicitly instead Signed-off-by: Yann Dirson <[email protected]>
1 parent 6cba4e6 commit 831d061

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

changelog/12535.doc.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
`This
2+
example`<https://docs.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures>
3+
showed ``print`` statements that do not exactly reflect what the
4+
different branches actually do. The fix makes the example more precise.

doc/en/example/simple.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -904,7 +904,9 @@ here is a little example implemented via a local plugin:
904904
# "function" scope
905905
report = request.node.stash[phase_report_key]
906906
if report["setup"].failed:
907-
print("setting up a test failed or skipped", request.node.nodeid)
907+
print("setting up a test failed", request.node.nodeid)
908+
elif report["setup"].skipped:
909+
print("setting up a test skipped", request.node.nodeid)
908910
elif ("call" not in report) or report["call"].failed:
909911
print("executing test failed or skipped", request.node.nodeid)
910912

0 commit comments

Comments
 (0)