

def test_callProcessExitedMissing(self):
    '\n        L{BaseProcess._callProcessExited} emits a L{DeprecationWarning} if the\n        object referred to by its C{proto} attribute has no C{processExited}\n        method.\n        '

    class FakeProto():
        pass
    reason = object()
    process = BaseProcess(FakeProto())
    self.addCleanup(setWarningMethod, getWarningMethod())
    warnings = []

    def collect(message, category, stacklevel):
        warnings.append((message, category, stacklevel))
    setWarningMethod(collect)
    process._callProcessExited(reason)
    [(message, category, stacklevel)] = warnings
    warnings.assertEqual(message, ('Since Twisted 8.2, IProcessProtocol.processExited is required.  %s.%s must implement it.' % (FakeProto.__module__, FakeProto.__name__)))
    self.assertIdentical(category, DeprecationWarning)
    self.assertEqual(stacklevel, 0)

dataset/ETHPy150Open kuri65536/python-for-android/python-modules/twisted/twisted/internet/test/test_baseprocess.py BaseProcessTests.test_callProcessExitedMissing/VarMisuse@105/193 `self`->`warnings`