Exemplo n.º 1
0
 def test_remote_close_during_call(self):
     chan, rchan = make_channel_pair()
     conn = Connection(chan)
     Connection(rchan).close()
     with self.assertRaisesRegex(DisconnectError,
                                 'Connection was remotely closed'):
         conn.call(nop)
     conn.close()
Exemplo n.º 2
0
 def test_recv_exception_is_ignored_after_send_exception(self):
     chan = FailingChannel()
     chan.connect_future.set_result(None)
     chan.close_future.set_result(None)
     with self.assertRaises(FirstError):
         conn = Connection(chan)
         chan.send_future.set_exception(FirstError())
         conn.wait()
         chan.recv_future.set_exception(SecondError())
         conn.close()
Exemplo n.º 3
0
 def _run_export_over_multiple_connections_test():
     options = Options(accept_exported_modules=True)
     conn1 = Connection(make_channel_pair()[0], options=options)
     try:
         Connection(make_channel_pair()[0], options=options)
     except ValueError:
         pass
     else:
         raise AssertionError('ValueError not raised')
     conn1.cancel()
     try:
         conn1.close()
     except Exception:  # generated by cancel()
         pass
Exemplo n.º 4
0
 def test_communication_error_during_call(self):
     chan = ConnectionChannel()
     conn = Connection(chan)
     try:
         with self.assertRaisesRegex(DisconnectError,
                                     'Connection was aborted due to .*'):
             conn.call(Box(chan.cancel)
                       )  # simulate communication error with channel.cancel
         with self.assertRaisesRegex(DisconnectError,
                                     'Connection was aborted due to .*'):
             conn.call(nop)
     finally:
         try:
             conn.close()
         except Exception:
             pass