def test_exitSuppressesReservationException(self):
        """
        An exception raised while re-opening the reserve file exiting
        a reservation's context manager block is suppressed but
        logged, allowing an exception raised within the block through.
        """
        class AllowedException(Exception):
            """
            The exception allowed out of the block.
            """

        class SuppressedException(Exception):
            """
            An exception raised by the file descriptor factory.
            """

        called = [False]

        def failsWithSuppressedExceptionAfterSecondOpen():
            if called[0]:
                raise SuppressedException()
            else:
                called[0] = True
                return io.BytesIO()

        reservedFD = _FileDescriptorReservation(
            failsWithSuppressedExceptionAfterSecondOpen)

        reservedFD.reserve()
        self.assertTrue(reservedFD.available())

        with self.assertRaises(AllowedException):
            with reservedFD:
                raise AllowedException()

        errors = self.flushLoggedErrors(SuppressedException)
        self.assertEqual(len(errors), 1)

        An exception raised while re-opening the reserve file exiting
        a reservation's context manager block is suppressed but
        logged, allowing an exception raised within the block through.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_tcp.py