PR feedback: Move changing of nextitem to runtestprotocol and also check for shouldstop
This commit is contained in:
parent
7176470866
commit
f90dc391e7
|
@ -131,6 +131,12 @@ def runtestprotocol(
|
|||
show_test_item(item)
|
||||
if not item.config.getoption("setuponly", False):
|
||||
reports.append(call_and_report(item, "call", log))
|
||||
|
||||
# If the session is about to fail or stop, teardown everything - this is
|
||||
# necessary to correctly report fixture teardown errors (see #11706)
|
||||
if item.session.shouldfail or item.session.shouldstop:
|
||||
nextitem = None
|
||||
|
||||
reports.append(call_and_report(item, "teardown", log, nextitem=nextitem))
|
||||
# After all teardown hooks have been called
|
||||
# want funcargs and request info to go away.
|
||||
|
@ -179,9 +185,6 @@ def pytest_runtest_call(item: Item) -> None:
|
|||
|
||||
def pytest_runtest_teardown(item: Item, nextitem: Optional[Item]) -> None:
|
||||
_update_current_test_var(item, "teardown")
|
||||
# If the session is about to fail, teardown everything - this is necessary
|
||||
# to correctly report fixture teardown errors (see #11706)
|
||||
nextitem = None if item.session.shouldfail else nextitem
|
||||
item.session._setupstate.teardown_exact(nextitem)
|
||||
_update_current_test_var(item, None)
|
||||
|
||||
|
|
Loading…
Reference in New Issue