# Path: googkit/lib/error.py
# class GoogkitError(Exception):
#     """Base class for error in Googkit."""
# 
#     def __init__(self, message):
#         """Creates a local error of googkit by the specified message.
#         """
#         self._message = message
# 
#     @property
#     def message(self):
#         return self._message
# 
#     def __str__(self):
#         return self.message


import unittest
import logging
import googkit
from googkit.compat.unittest import mock
from googkit.lib.error import GoogkitError
                googkit.main()

        mock_basic_cfg.assert_called_once_with(level=logging.INFO, format='%(message)s')

        self.assertTrue(MockHelp.return_value.print_help.called)

    def test_run_with_invalid_args(self):
        with mock.patch('os.chdir'), \
                mock.patch('sys.argv', new=['/DUMMY.py', 'dummy']), \
                mock.patch('googkit.Help') as MockHelp, \
                mock.patch('googkit.Environment', return_value='dummy_env'), \
                mock.patch('googkit.CommandTree') as MockTree, \
                mock.patch('googkit.lib.plugin.load'), \
                mock.patch('logging.basicConfig') as mock_basic_cfg:
            MockTree.return_value.command_class.return_value = None

            with self.assertRaises(SystemExit):
                googkit.main()

        mock_basic_cfg.assert_called_once_with(level=logging.INFO, format='%(message)s')

        self.assertTrue(MockHelp.return_value.print_help.called)

    def test_run_with_exception(self):
        MockCmd = mock.MagicMock()
        MockCmd.needs_project_config.return_value = False
        mock_cmd = MockCmd.return_value
        mock_cmd.run.side_effect = GoogkitError('DUMMY')

        with mock.patch('os.chdir'), \

# Path: googkit/lib/error.py
# class GoogkitError(Exception):
#     """Base class for error in Googkit."""
# 
#     def __init__(self, message):
#         """Creates a local error of googkit by the specified message.
#         """
#         self._message = message
# 
#     @property
#     def message(self):
#         return self._message
# 
#     def __str__(self):
#         return self.message


# Path: test/test_init.py
import unittest
import logging
import googkit
from googkit.compat.unittest import mock
from googkit.lib.error import GoogkitError

                googkit.main()

        mock_basic_cfg.assert_called_once_with(level=logging.INFO, format='%(message)s')

        self.assertTrue(MockHelp.return_value.print_help.called)

    def test_run_with_invalid_args(self):
        with mock.patch('os.chdir'), \
                mock.patch('sys.argv', new=['/DUMMY.py', 'dummy']), \
                mock.patch('googkit.Help') as MockHelp, \
                mock.patch('googkit.Environment', return_value='dummy_env'), \
                mock.patch('googkit.CommandTree') as MockTree, \
                mock.patch('googkit.lib.plugin.load'), \
                mock.patch('logging.basicConfig') as mock_basic_cfg:
            MockTree.return_value.command_class.return_value = None

            with self.assertRaises(SystemExit):
                googkit.main()

        mock_basic_cfg.assert_called_once_with(level=logging.INFO, format='%(message)s')

        self.assertTrue(MockHelp.return_value.print_help.called)

    def test_run_with_exception(self):
        MockCmd = mock.MagicMock()
        MockCmd.needs_project_config.return_value = False
        mock_cmd = MockCmd.return_value
        mock_cmd.run.side_effect = GoogkitError('DUMMY')

        with mock.patch('os.chdir'), \

                mock.patch('sys.argv', new=['/DUMMY.py', 'dummy1', 'dummy2']), \