def test_operator_except_formatting(self): op = self.BrokenOp(graph=graph.Graph()) exc = None try: op.Out.value except Exception as e: exc = e assert exc stack = operator.format_operator_stack(exc.__traceback__) assert stack assert len(stack) == 2 assert "TestOperatorStackFormatter.BrokenOp.execute" in stack[0]
def pytest_exception_interact(node, call, report): if call.excinfo: stack = format_operator_stack(call.excinfo.tb) if stack: formatted_stack = "".join(stack) report.sections.append(("Operator Stack", formatted_stack))