Example #1
0
 def end(self):
     """
     Ask stack-ide to shut down.
     """
     Win(self.window).hide_error_panel()
     self.send_request(Req.get_shutdown())
     self.die()
Example #2
0
 def end(self):
     """
     Ask stack-ide to shut down.
     """
     Win(self.window).hide_error_panel()
     self.send_request(Req.get_shutdown())
     self.die()
Example #3
0
 def test_can_shutdown(self, loadtargets_mock):
     backend = FakeBackend()
     backend.send_request = Mock()
     instance = stackide.StackIDE(
         mock_window([cur_dir + '/projects/helloworld/']), test_settings, backend)
     self.assertIsNotNone(instance)
     self.assertTrue(instance.is_active)
     self.assertTrue(instance.is_alive)
     instance.end()
     self.assertFalse(instance.is_active)
     self.assertFalse(instance.is_alive)
     backend.send_request.assert_called_with(
         Req.get_shutdown())
Example #4
0
    def test_kills_live_orphans(self):
        window = sublime.create_window('.')
        StackIDEManager.check_windows()
        self.assertEqual(1, len(StackIDEManager.ide_backend_instances))

        # substitute a 'live' instance
        backend = MagicMock()
        stack_ide.stack_ide_loadtargets = Mock(return_value=['app/Main.hs', 'src/Lib.hs'])
        instance = stack_ide.StackIDE(window, test_settings, backend)
        StackIDEManager.ide_backend_instances[window.id()] = instance

        # close the window
        sublime.destroy_windows()

        # instance should be killed
        StackIDEManager.check_windows()
        self.assertEqual(0, len(StackIDEManager.ide_backend_instances))
        self.assertFalse(instance.is_alive)
        backend.send_request.assert_called_with(Req.get_shutdown())
Example #5
0
    def test_reset(self):
        window = mock_window(['.'])
        sublime.add_window(window)

        StackIDEManager.check_windows()
        self.assertEqual(1, len(StackIDEManager.ide_backend_instances))

        # substitute a 'live' instance
        backend = MagicMock()
        stack_ide.stack_ide_loadtargets = Mock(return_value=['app/Main.hs', 'src/Lib.hs'])
        instance = stack_ide.StackIDE(window, test_settings, backend)
        StackIDEManager.ide_backend_instances[window.id()] = instance

        StackIDEManager.reset()

        # instances should be shut down.
        self.assertEqual(1, len(StackIDEManager.ide_backend_instances))
        self.assertFalse(instance.is_alive)
        backend.send_request.assert_called_with(Req.get_shutdown())

        sublime.destroy_windows()
Example #6
0
 def end(self):
     """
     Ask stack-ide to shut down.
     """
     self.send_request(Req.get_shutdown())
     self.die()