def _runCleanups(self, result):
        """
        Synchronously run any cleanups which have been added.
        """
        while len(self._cleanups) > 0:
            f, args, kwargs = self._cleanups.pop()
            try:
                f(*args, **kwargs)
            except:
                f = failure.Failure()
                result.addError(self, f)

        Synchronously run any cleanups which have been added.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/trial/_synctest.py