Exemplo n.º 1
0
    def test_multicall_with_lock_held(self):
        self.config(debug=True)
        self.assertFalse(rpc._check_for_lock())

        @lockutils.synchronized('detecting', 'test-')
        def f():
            self.assertTrue(rpc._check_for_lock())
        f()

        self.assertFalse(rpc._check_for_lock())
Exemplo n.º 2
0
    def test_multicall_with_lock_held(self):
        self.config(debug=True)
        self.assertFalse(rpc._check_for_lock())

        @lockutils.synchronized('detecting', 'test-')
        def f():
            self.assertTrue(rpc._check_for_lock())
        f()

        self.assertFalse(rpc._check_for_lock())
Exemplo n.º 3
0
 def _fake_rpc_method_timeout(*args, **kwargs):
     rpc._check_for_lock()
     self.fake_args = args
     self.fake_kwargs = kwargs
     raise rpc_common.Timeout("The spider got you")
Exemplo n.º 4
0
 def _fake_rpc_method(*args, **kwargs):
     rpc._check_for_lock()
     self.fake_args = args
     self.fake_kwargs = kwargs
     if has_retval:
         return expected_retval
Exemplo n.º 5
0
 def f():
     self.assertTrue(rpc._check_for_lock())
Exemplo n.º 6
0
 def _fake_rpc_method_timeout(*args, **kwargs):
     rpc._check_for_lock()
     self.fake_args = args
     self.fake_kwargs = kwargs
     raise rpc_common.Timeout("The spider got you")
Exemplo n.º 7
0
 def _fake_rpc_method(*args, **kwargs):
     rpc._check_for_lock()
     self.fake_args = args
     self.fake_kwargs = kwargs
     if has_retval:
         return expected_retval
Exemplo n.º 8
0
 def f():
     self.assertTrue(rpc._check_for_lock())