Beispiel #1
0
 def __call__(self):
     """
     Invoke the RMI as follows:
       - Fork
       - Start the monitor.
       - Read and dispatch reply messages.
     :return: Whatever method returned.
     """
     pipe = Pipe()
     target = Target(self.method, *self.args, **self.kwargs)
     child = Process(target, pipe)
     monitor = Monitor(Context.current(), child)
     try:
         child.start()
         monitor.start()
         pipe.writer.close()
         retval = self.read(pipe.reader)
         return retval
     finally:
         pipe.close()
         monitor.stop()
         child.wait()
Beispiel #2
0
 def test_wait_error(self, wait):
     wait.side_effect = OSError()
     p = Process(Mock())
     p.wait()
     wait.assert_called_once_with(p.pid, 0)
Beispiel #3
0
 def test_wait(self, wait):
     p = Process(Mock())
     p.wait()
     wait.assert_called_once_with(p.pid, 0)
Beispiel #4
0
 def test_wait(self, wait):
     p = Process(Mock())
     p.wait()
     wait.assert_called_once_with(p.pid, 0)
Beispiel #5
0
 def test_wait_error(self, wait):
     wait.side_effect = OSError()
     p = Process(Mock())
     p.wait()
     wait.assert_called_once_with(p.pid, 0)