Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitcf19df9

Browse files
pytest_runtest_makereport is updated (refactoring+documentation)
1 parent712de46 commitcf19df9

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

‎tests/conftest.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,12 @@ def helper__makereport__call(
390390

391391
@pytest.hookimpl(hookwrapper=True)
392392
defpytest_runtest_makereport(item:pytest.Function,call:pytest.CallInfo):
393+
#
394+
# https://docs.pytest.org/en/7.1.x/how-to/writing_hook_functions.html#hookwrapper-executing-around-other-hooks
395+
#
396+
# Note that hook wrappers don’t return results themselves,
397+
# they merely perform tracing or other side effects around the actual hook implementations.
398+
#
393399
assertitemisnotNone
394400
assertcallisnotNone
395401
# it may be pytest.Function or _pytest.unittest.TestCaseFunction
@@ -400,6 +406,8 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo):
400406
assertoutcomeisnotNone
401407
asserttype(outcome)==pluggy.Result# noqa: E721
402408

409+
asserttype(call.when)==str
410+
403411
ifcall.when=="collect":
404412
return
405413

@@ -414,7 +422,9 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo):
414422
ifcall.when=="teardown":
415423
return
416424

417-
assertFalse
425+
errMsg="[pytest_runtest_makereport] unknown 'call.when' value: [{0}].".format(call.when)
426+
427+
raiseRuntimeError(errMsg)
418428

419429

420430
# /////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp