code: def repr_failure(self, excinfo):
          
          exc = excinfo.value
          cc = self.colors
          if isinstance(exc, NbCellError):
              msg_items = [
                  cc.FAIL + "Notebook cell execution failed" + cc.ENDC]
              formatstring = (
                  cc.OKBLUE + "Cell %d: %s\n\n" +
                  "Input:\n" + cc.ENDC + "%s\n")
              msg_items.append(formatstring % (
                  exc.cell_num,
                  str(exc),
                  exc.source
              ))
              if exc.inner_traceback:
                  msg_items.append((
                      cc.OKBLUE + "Traceback:" + cc.ENDC + "\n%s\n") %
                      exc.inner_traceback)
              return "\n".join(msg_items)
          else:
              return "pytest plugin exception: %s" % str(exc)
docs: called when self.runtest() raises an exception.