3 from __future__ import absolute_import, print_function
13 from . import testutil
15 import arvnodeman.baseactor
17 class BogusActor(arvnodeman.baseactor.BaseNodeManagerActor):
18 def __init__(self, e):
19 super(BogusActor, self).__init__()
25 class ActorUnhandledExceptionTest(unittest.TestCase):
26 def test_fatal_error(self):
27 for e in (MemoryError(), threading.ThreadError(), OSError(errno.ENOMEM, "")):
28 with mock.patch('os.killpg') as killpg_mock:
29 act = BogusActor.start(e).tell_proxy()
31 act.actor_ref.stop(block=True)
32 self.assertTrue(killpg_mock.called)
34 def test_nonfatal_error(self):
35 with mock.patch('os.killpg') as killpg_mock:
36 act = BogusActor.start(OSError(errno.ENOENT, "")).tell_proxy()
38 act.actor_ref.stop(block=True)
39 self.assertFalse(killpg_mock.called)