def test_exitOpensFileOnException(self):
        """
        An exception raised within a reservation context manager's
        block does not prevent the file from being reopened.
        """
        class TestException(Exception):
            """
            An exception only used by this test.
            """

        self.reservedFD.reserve()
        with self.assertRaises(TestException):
            with self.reservedFD:
                raise TestException()

        An exception raised within a reservation context manager's
        block does not prevent the file from being reopened.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/internet/test/test_tcp.py