|
|
@ -36,7 +36,17 @@ def func_accepts_returns_sender(sender):
|
|
|
|
return sender
|
|
|
|
return sender
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class TargetClass:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
offset = 100
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@classmethod
|
|
|
|
|
|
|
|
def add_numbers_with_offset(cls, x, y):
|
|
|
|
|
|
|
|
return cls.offset + x + y
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class CallFunctionTest(testlib.RouterMixin, testlib.TestCase):
|
|
|
|
class CallFunctionTest(testlib.RouterMixin, testlib.TestCase):
|
|
|
|
|
|
|
|
|
|
|
|
def setUp(self):
|
|
|
|
def setUp(self):
|
|
|
|
super(CallFunctionTest, self).setUp()
|
|
|
|
super(CallFunctionTest, self).setUp()
|
|
|
|
self.local = self.router.fork()
|
|
|
|
self.local = self.router.fork()
|
|
|
@ -44,6 +54,12 @@ class CallFunctionTest(testlib.RouterMixin, testlib.TestCase):
|
|
|
|
def test_succeeds(self):
|
|
|
|
def test_succeeds(self):
|
|
|
|
self.assertEqual(3, self.local.call(function_that_adds_numbers, 1, 2))
|
|
|
|
self.assertEqual(3, self.local.call(function_that_adds_numbers, 1, 2))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def test_succeeds_class_method(self):
|
|
|
|
|
|
|
|
self.assertEqual(
|
|
|
|
|
|
|
|
self.local.call(TargetClass.add_numbers_with_offset, 1, 2),
|
|
|
|
|
|
|
|
103,
|
|
|
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
def test_crashes(self):
|
|
|
|
def test_crashes(self):
|
|
|
|
exc = self.assertRaises(mitogen.core.CallError,
|
|
|
|
exc = self.assertRaises(mitogen.core.CallError,
|
|
|
|
lambda: self.local.call(function_that_fails))
|
|
|
|
lambda: self.local.call(function_that_fails))
|
|
|
|