Ejemplo n.º 1
0
 def testBuf(self):
     """Try moving a buffer"""
     with open(self.filename, "wb") as outpipe:
         LLPC = LowLevelPipeConnection(None, outpipe)
         with open(regfilename, "rb") as inpipe:
             inbuf = inpipe.read()
         LLPC._putbuf(inbuf, 234)
     with open(self.filename, "rb") as inpipe:
         LLPC.inpipe = inpipe
         self.assertEqual((234, inbuf), LLPC._get())
     os.unlink(self.filename)
Ejemplo n.º 2
0
 def testObjects(self):
     """Try moving objects across connection"""
     with open(self.filename, "wb") as outpipe:
         LLPC = LowLevelPipeConnection(None, outpipe)
         for obj in self.objs:
             LLPC._putobj(obj, 3)
     with open(self.filename, "rb") as inpipe:
         LLPC.inpipe = inpipe
         for obj in self.objs:
             gotten = LLPC._get()
             self.assertEqual(gotten, (3, obj))
     os.unlink(self.filename)
Ejemplo n.º 3
0
 def testSendingExceptions(self):
     """Exceptions should also be sent down pipe well"""
     with open(self.filename, "wb") as outpipe:
         LLPC = LowLevelPipeConnection(None, outpipe)
         for exception in self.excts:
             LLPC._putobj(exception, 0)
     with open(self.filename, "rb") as inpipe:
         LLPC.inpipe = inpipe
         for exception in self.excts:
             incoming_exception = LLPC._get()
             assert isinstance(incoming_exception[1], exception.__class__)
     os.unlink(self.filename)