def test_unpickling_leak(self): with make_connection() as conn: with self.assertRaises(across.OperationError): conn.call( nop, across.ref(self.make_obj()), across.ref(self.make_obj()), BrokenUnpickle(), across.ref(self.make_obj()), across.ref(self.make_obj()), ) self.verify_no_leak(conn)
def test_pickling_proxy_remotely(self): def func(proxy): pickle.dumps(proxy) with make_connection() as conn: with self.assertRaises(RuntimeError): conn.call(Box(func), across.ref(None))
def test_ref(self): with make_connection() as conn: proxy = conn.call(Box(lambda: across.ref(5))) self.assertIsInstance(proxy, across.Proxy) self.assertEqual(copy.deepcopy(proxy), 5)
def create_remotely(): obj = Counter() obj_weakref.value = weakref.ref(obj) return across.ref(obj)
def func(): pickle.dumps(across.ref(None))
def test_ref_with_builtin_func(self): with make_connection() as conn: self.assertEqual(conn.call(call, across.ref(max), 5, 10), 10)
def test_ref_with_func(self): with make_connection() as conn: self.assertEqual(conn.call(call, across.ref(get_args), 5), ((5, ), {}))
def test_ref_with_lambda(self): with make_connection() as conn: self.assertEqual(conn.call(call, across.ref(lambda: 5)), 5)