def test_errorInCallbackDoesNotCaptureVars(self):
        """
        An error raised by a callback creates a Failure.  The Failure captures
        locals and globals if and only if C{Deferred.debug} is set.
        """
        d = defer.Deferred()
        d.callback(None)
        defer.setDebugging(False)
        def raiseError(ignored):
            raise GenericError("Bang")
        d.addCallback(raiseError)
        l = []
        d.addErrback(l.append)
        fail = l[0]
        localz, globalz = fail.frames[0][-2:]
        self.assertEqual([], localz)
        self.assertEqual([], globalz)

        An error raised by a callback creates a Failure.  The Failure captures
        locals and globals if and only if C{Deferred.debug} is set.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_defer.py