'When C{os.fork} raises an exception, the file descriptors created by
C{pty.openpty} are closed and don\'t leak, when C{usePTY} is set to
C{True}.'

def test_mockForkErrorClosePTY(self):

    self.mockos.raiseFork = OSError(errno.EAGAIN, None)
    protocol = TrivialProcessProtocol(None)
    self.assertRaises(OSError, reactor.spawnProcess, protocol, None, usePTY=True)
    self.assertEqual(self.mockos.actions, [('fork', False)])
    self.assertEqual(set(self.mockos.closed), set([(-12), (-13)]))
