'When there is a C{\'before\'} C{\'startup\'} trigger which returns an
unfired L{Deferred}, C{reactor.run()} starts the reactor and does not
return until after C{reactor.stop()} is called'

def test_runWithAsynchronousBeforeStartupTrigger(self):

    events = []
    def trigger():
        events.append('trigger')
        d = Deferred()
        d.addCallback(callback)
        reactor.callLater(0, d.callback, None)
        return d
    def callback(ignored):
        events.append('callback')
        reactor.stop()
    reactor = self.buildReactor()
    reactor.addSystemEventTrigger('before', 'startup', trigger)
    self.runReactor(reactor)
    self.assertEqual(events, ['trigger', 'callback'])
