test/worker: test exception logging

This commit is contained in:
Sebastien Bourdeauducq 2016-03-02 17:12:22 +08:00
parent 763a4d3011
commit f5dee455f5
1 changed files with 6 additions and 2 deletions

View File

@ -87,8 +87,12 @@ class WorkerCase(unittest.TestCase):
_run_experiment("SimpleExperiment") _run_experiment("SimpleExperiment")
def test_exception(self): def test_exception(self):
with self.assertRaises(WorkerInternalException): with self.assertLogs() as logs:
_run_experiment("ExceptionTermination") with self.assertRaises(WorkerInternalException):
_run_experiment("ExceptionTermination")
self.assertEqual(len(logs.records), 1)
self.assertIn("Terminating with exception (TypeError)",
logs.output[0])
def test_watchdog_no_timeout(self): def test_watchdog_no_timeout(self):
_run_experiment("WatchdogNoTimeout") _run_experiment("WatchdogNoTimeout")