File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -390,6 +390,12 @@ def helper__makereport__call(
390390
391391@pytest .hookimpl (hookwrapper = True )
392392def pytest_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 assert item is not None
394400 assert call is not None
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 assert outcome is not None
401407 assert type (outcome ) == pluggy .Result # noqa: E721
402408
409+ assert type (call .when ) == str
410+
403411 if call .when == "collect" :
404412 return
405413
@@ -414,7 +422,9 @@ def pytest_runtest_makereport(item: pytest.Function, call: pytest.CallInfo):
414422 if call .when == "teardown" :
415423 return
416424
417- assert False
425+ errMsg = "[pytest_runtest_makereport] unknown 'call.when' value: [{0}]." .format (call .when )
426+
427+ raise RuntimeError (errMsg )
418428
419429
420430# /////////////////////////////////////////////////////////////////////////////
You can’t perform that action at this time.
0 commit comments