# 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 os
import re
import googkit.lib.path
from googkit.compat.unittest import mock
from googkit.lib.error import GoogkitError
            exists = [os.path.abspath(exist) for exist in [
                '/',
                '/dir1',
                '/dir1/dir2',
                '/dir1/dir2/dir3',
                '/dir1/dir2/dir3/dir4',
                '/dir1/dir2/dir3/dir4/googkit.cfg',
            ]]

            return os.path.abspath(path) in exists

        cwd = os.path.normcase('/dir1/dir2/dir3/dir4')
        with mock.patch('os.path.exists', side_effect=stub_exists):
            self.assertPathEqual(
                googkit.lib.path.project_root(cwd),
                '/dir1/dir2/dir3/dir4')

    def test_project_config(self):
        def stub_exists(path):
            if is_path_equal(path, '/dir1/dir2/googkit.cfg'):
                return True
            else:
                return False

        cwd = os.path.normcase('/dir1/dir2/dir3/dir4')
        dummy_project_root = os.path.normcase('/dir1/dir2')
        with mock.patch('os.path.exists', side_effect=stub_exists), \
                mock.patch('googkit.lib.path.project_root', return_value=dummy_project_root):
            self.assertPathEqual(
                googkit.lib.path.project_config(cwd),

# 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/lib/test_path.py
import unittest
import os
import re
import googkit.lib.path
from googkit.compat.unittest import mock
from googkit.lib.error import GoogkitError

            exists = [os.path.abspath(exist) for exist in [
                '/',
                '/dir1',
                '/dir1/dir2',
                '/dir1/dir2/dir3',
                '/dir1/dir2/dir3/dir4',
                '/dir1/dir2/dir3/dir4/googkit.cfg',
            ]]

            return os.path.abspath(path) in exists

        cwd = os.path.normcase('/dir1/dir2/dir3/dir4')
        with mock.patch('os.path.exists', side_effect=stub_exists):
            self.assertPathEqual(
                googkit.lib.path.project_root(cwd),
                '/dir1/dir2/dir3/dir4')

    def test_project_config(self):
        def stub_exists(path):
            if is_path_equal(path, '/dir1/dir2/googkit.cfg'):
                return True
            else:
                return False

        cwd = os.path.normcase('/dir1/dir2/dir3/dir4')
        dummy_project_root = os.path.normcase('/dir1/dir2')
        with mock.patch('os.path.exists', side_effect=stub_exists), \
                mock.patch('googkit.lib.path.project_root', return_value=dummy_project_root):
            self.assertPathEqual(
                googkit.lib.path.project_config(cwd),

                '/dir1/dir2/googkit.cfg')