Beispiel #1
0
 def test_delete_kernel(self):
     language = 'python'
     controller = KernelController(PATH)
     kernel = controller._get_kernel(language)
     pid = kernel.pid
     self.assertEqual(check_pid(pid), True)
     controller.delete_kernel(language)
     kernel.wait()
     self.assertEqual(check_pid(pid), False)
     self.assertEqual(language in controller, False)
Beispiel #2
0
 def test_evaluate(self):
     commands = {
         'python': ('print range(4)', [0, 1, 2, 3]),
         'ruby': ('puts 5+2', 7),
     }
     controller = KernelController(PATH)
     for language in controller.languages():
         code, expected = commands[language]
         message = Message(language=language, content=code)
         result = controller.evaluate(message)
         self.assertEquals(result, respond(expected))
Beispiel #3
0
 def test_delete_controller(self):
     """
     Check that deleting a controller will kill child subprocesses.
     """
     
     controller = KernelController(PATH)
     kernels = [controller._get_kernel(lang) \
             for lang in controller.languages()]
     pids = [kernel.pid for kernel in kernels]
     del controller
     for pid, kernel in zip(pids, kernels):
         kernel.wait()
         self.assertEquals(check_pid(pid), False)