call_function_test: Fix assumption that we run as a script

This commit is contained in:
Alex Willmer 2018-04-01 01:23:13 +01:00
parent 0dcaeb21a2
commit a22294dda9
1 changed files with 4 additions and 1 deletions

View File

@ -64,7 +64,10 @@ class CallFunctionTest(testlib.RouterMixin, testlib.TestCase):
def test_bad_return_value(self): def test_bad_return_value(self):
exc = self.assertRaises(mitogen.core.StreamError, exc = self.assertRaises(mitogen.core.StreamError,
lambda: self.local.call(func_with_bad_return_value)) lambda: self.local.call(func_with_bad_return_value))
self.assertEquals(exc[0], "cannot unpickle '__main__'/'CrazyType'") self.assertEquals(
exc[0],
"cannot unpickle '%s'/'CrazyType'" % (__name__,),
)
def test_returns_dead(self): def test_returns_dead(self):
self.assertEqual(mitogen.core._DEAD, self.local.call(func_returns_dead)) self.assertEqual(mitogen.core._DEAD, self.local.call(func_returns_dead))