Exemple #1
0
    def test_excepted(self):
        proc = test_utils.ExceptionProcess()
        events_tester = test_utils.ProcessListenerTester(
            proc, (
                'excepted',
                'running',
                'output_emitted',
            ), self.loop.stop)
        with self.assertRaises(RuntimeError):
            proc.execute()

        # Do the checks
        self.assertIsNotNone(proc.exception())
        self.assertSetEqual(events_tester.called,
                            events_tester.expected_events)
Exemple #2
0
    def test_excepted(self):
        proc = test_utils.ExceptionProcess()
        events_tester = test_utils.ProcessListenerTester(
            proc, (
                'excepted',
                'running',
                'output_emitted',
            ))
        with self.assertRaises(RuntimeError):
            yield proc.step_until_terminated()
            proc.result()

        # Do the checks
        self.assertIsNotNone(proc.exception())
        self.assertSetEqual(events_tester.called,
                            events_tester.expected_events)
Exemple #3
0
 def test_exc_info(self):
     proc = test_utils.ExceptionProcess()
     try:
         proc.execute()
     except RuntimeError as e:
         self.assertEqual(proc.exception(), e)
Exemple #4
0
 def test_exception(self):
     proc = test_utils.ExceptionProcess()
     with self.assertRaises(RuntimeError):
         proc.execute()
     self.assertEqual(proc.state, ProcessState.EXCEPTED)