def test_writeErrors(self):
        """
        Test error path for L{fdesc.writeTod}.
        """
        oldOsWrite = os.write
        def eagainWrite(fd, data):
            err = OSError()
            err.errno = errno.EAGAIN
            raise err
        os.write = eagainWrite
        try:
            self.assertEqual(self.write(b"s"), 0)
        finally:
            os.write = oldOsWrite

        def eintrWrite(fd, data):
            err = OSError()
            err.errno = errno.EINTR
            raise err
        os.write = eintrWrite
        try:
            self.assertEqual(self.write(b"s"), 0)
        finally:
            os.write = oldOsWrite

        Test error path for L{fdesc.writeTod}.
        
stackoverflow/venv/lib/python3.6/site-packages/twisted/test/test_fdesc.py