'L{task.react} returns quickly if the L{defer.Deferred} returned by the
function it is passed has already been errbacked at the time it is
returned.'

def test_runsUntilSyncErrback(self):

    class ExpectedException(Exception, ):
        pass
    def main(reactor):
        return defer.fail(ExpectedException())
    r = _FakeReactor()
    exitError = self.assertRaises(SystemExit, task.react, main, _reactor=r)
    self.assertEqual(1, exitError.code)
    self.assertEqual(r.seconds(), 0)
    errors = self.flushLoggedErrors(ExpectedException)
    self.assertEqual(len(errors), 1)
