示例#1
0
 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)
示例#2
0
    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))
示例#3
0
 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)
示例#4
0
 def create_remotely():
     obj = Counter()
     obj_weakref.value = weakref.ref(obj)
     return across.ref(obj)
示例#5
0
 def func():
     pickle.dumps(across.ref(None))
示例#6
0
 def test_ref_with_builtin_func(self):
     with make_connection() as conn:
         self.assertEqual(conn.call(call, across.ref(max), 5, 10), 10)
示例#7
0
 def test_ref_with_func(self):
     with make_connection() as conn:
         self.assertEqual(conn.call(call, across.ref(get_args), 5),
                          ((5, ), {}))
示例#8
0
 def test_ref_with_lambda(self):
     with make_connection() as conn:
         self.assertEqual(conn.call(call, across.ref(lambda: 5)), 5)