'C{"before"} C{"shutdown"} triggers are not run synchronously from
L{reactor.stop}.'

def test_shutdownFiresTriggersAsynchronously(self):

    reactor = self.buildReactor()
    events = []
    reactor.addSystemEventTrigger('before', 'shutdown', events.append, 'before    shutdown')
    def stopIt():
        reactor.stop()
        events.append('stopped')
    reactor.callWhenRunning(stopIt)
    self.assertEqual(events, [])
    self.runReactor(reactor)
    self.assertEqual(events, ['stopped', 'before    shutdown'])
