'Test error path for L{fdesc.writeTod}.'

def test_writeErrors(self):

    oldOsWrite = os.write
    def eagainWrite(fd, data):
        err = OSError()
        err.errno = errno.EAGAIN
        raise err
    os.write = eagainWrite
    try:
        self.assertEqual(self.write('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('s'), 0)
    finally:
        os.write = oldOsWrite
