Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
examples: be more precise about TestReport outcome
* testing only for "failed" should not be reported as "or skipped"
* test for "skipped" explicitly instead

Signed-off-by: Yann Dirson <yann.dirson@vates.tech>
  • Loading branch information
ydirson committed Oct 21, 2024
commit 1272cd988f73310e5d231847534620480357a48e
4 changes: 4 additions & 0 deletions changelog/12535.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
`This
Comment thread
nicoddemus marked this conversation as resolved.
example`<https://docs.pytest.org/en/latest/example/simple.html#making-test-result-information-available-in-fixtures>
showed ``print`` statements that do not exactly reflect what the
different branches actually do. The fix makes the example more precise.
4 changes: 3 additions & 1 deletion doc/en/example/simple.rst
Original file line number Diff line number Diff line change
Expand Up @@ -904,7 +904,9 @@ here is a little example implemented via a local plugin:
# "function" scope
report = request.node.stash[phase_report_key]
if report["setup"].failed:
print("setting up a test failed or skipped", request.node.nodeid)
print("setting up a test failed", request.node.nodeid)
elif report["setup"].skipped:
print("setting up a test skipped", request.node.nodeid)
elif ("call" not in report) or report["call"].failed:
print("executing test failed or skipped", request.node.nodeid)

Expand Down