def testWriteAfterClose(self): r, w = os.pipe() fw = FD(w) fw.close() try: with self.assertRaises(OSError) as ar: fw.write("oops") self.assertEquals(ar.exception.errno, errno.EBADF) finally: FD(r).close()
def testNonblocking(self): r, w = os.pipe() fr = FD(r) try: fr.set_nonblocking() with self.assertRaises(OSError) as ar: fr.read(1) self.assertEquals(ar.exception.errno, errno.EAGAIN) finally: fr.close() FD(w).close()