File tree Expand file tree Collapse file tree 1 file changed +8
-12
lines changed
Expand file tree Collapse file tree 1 file changed +8
-12
lines changed Original file line number Diff line number Diff 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
244240def pytest_configure (config : pytest .Config ):
You can’t perform that action at this time.
0 commit comments