Пример #1
0
 def test_popen_with_callback_with_endmarker_and_unpickling_error(self):
     channel = self.gw.remote_exec("""
         from py.__.test.dist.mypickle import PickleChannel
         channel = PickleChannel(channel)
         from py.__.test.dist.testing.test_mypickle import A
         a1 = A()
         channel.send(a1)
         channel.send(a1)
     """)
     channel = PickleChannel(channel)
     queue = py.std.Queue.Queue()
     a = channel.receive()
     channel._ipickle._unpicklememo.clear()
     channel.setcallback(queue.put, endmarker=-1)
     next = queue.get(timeout=TESTTIMEOUT)
     assert next == -1 
     error = channel._getremoteerror()
     assert isinstance(error, UnpickleError)
Пример #2
0
 def test_popen_with_callback_with_endmarker_and_unpickling_error(self):
     channel = self.gw.remote_exec("""
         from py.__.test.dist.mypickle import PickleChannel
         channel = PickleChannel(channel)
         from py.__.test.dist.testing.test_mypickle import A
         a1 = A()
         channel.send(a1)
         channel.send(a1)
     """)
     channel = PickleChannel(channel)
     queue = py.std.Queue.Queue()
     a = channel.receive()
     channel._ipickle._unpicklememo.clear()
     channel.setcallback(queue.put, endmarker=-1)
     next = queue.get(timeout=TESTTIMEOUT)
     assert next == -1
     error = channel._getremoteerror()
     assert isinstance(error, UnpickleError)
Пример #3
0
 def test_popen_with_callback(self):
     channel = self.gw.remote_exec("""
         from py.__.test.dist.mypickle import PickleChannel
         channel = PickleChannel(channel)
         from py.__.test.dist.testing.test_mypickle import A
         a1 = A()
         a1.hello = 10
         channel.send(a1)
         a2 = channel.receive()
         channel.send(a2 is a1)
     """)
     channel = PickleChannel(channel)
     queue = py.std.Queue.Queue()
     channel.setcallback(queue.put)
     a_received = queue.get(timeout=TESTTIMEOUT)
     assert isinstance(a_received, A)
     assert a_received.hello == 10
     channel.send(a_received)
Пример #4
0
 def test_popen_with_callback(self):
     channel = self.gw.remote_exec("""
         from py.__.test.dist.mypickle import PickleChannel
         channel = PickleChannel(channel)
         from py.__.test.dist.testing.test_mypickle import A
         a1 = A()
         a1.hello = 10
         channel.send(a1)
         a2 = channel.receive()
         channel.send(a2 is a1)
     """)
     channel = PickleChannel(channel)
     queue = py.std.Queue.Queue()
     channel.setcallback(queue.put)
     a_received = queue.get(timeout=TESTTIMEOUT)
     assert isinstance(a_received, A)
     assert a_received.hello == 10
     channel.send(a_received)