def test_enter_after_cancel(self): # There are no writes to chan2, so handshake should never complete chan1, chan2 = make_channel_pair() conn = Connection(chan1) conn.cancel() with self.assertRaises(ValueError): conn.__enter__()
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