'If a before-phase trigger tries to remove another before-phase trigger
which has already run, a warning should be emitted.'

def test_synchronousRemoveAlreadyExecutedBefore(self):

    events = []
    def removeTrigger():
        self.event.removeTrigger(beforeHandle)
    beforeHandle = self.event.addTrigger('before', events.append, ('first', 'before'))
    self.event.addTrigger('before', removeTrigger)
    self.event.addTrigger('before', events.append, ('second', 'before'))
    self.assertWarns(DeprecationWarning, 'Removing    already-fired    system    event    triggers    will    raise    an    exception    in    a    future    version    of    Twisted.', __file__, self.event.fireEvent)
    self.assertEqual(events, [('first', 'before'), ('second', 'before')])
