Skip to content

Commit ed8f91e

Browse files
committed
shotgun debugging
1 parent 113825b commit ed8f91e

File tree

1 file changed

+8
-12
lines changed

1 file changed

+8
-12
lines changed

tests/conftest.py

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -225,20 +225,16 @@ def pytest_runtest_makereport(item: pytest.Item, call: pytest.CallInfo):
225225
result: pytest.TestReport = outcome.get_result()
226226

227227
if result.when != "teardown":
228-
return
228+
return result
229229

230230
# If we specifically failed with a StashKey error in teardown, mark the test as passed
231-
if result.failed:
232-
exception = call.excinfo
233-
if (
234-
exception
235-
and isinstance(exception.value, KeyError)
236-
and "_pytest.stash.StashKey" in repr(exception)
237-
):
238-
result.outcome = "passed"
239-
item.add_report_section(
240-
"teardown", "stderr", f"Ignored tmp_path teardown error: {exception}"
241-
)
231+
if (exception := call.excinfo) and "_pytest.stash.StashKey" in repr(exception):
232+
call.excinfo = None
233+
result.outcome = "passed"
234+
item.add_report_section(
235+
"teardown", "stderr", f"Ignored tmp_path teardown error: {exception}"
236+
)
237+
return result
242238

243239

244240
def pytest_configure(config: pytest.Config):

0 commit comments

Comments
 (0)