# Path: vimswitch/test/FileSystemTestCase.py
# class FileSystemTestCase(BaseTestCase):
#     """
#     Inherit from this class when a unit test needs to access the disk. This
#     class sets up a sandbox so that disk modifications only occur within a
#     working directory. This keeps test code from affecting other files on the
#     system.
# 
#     To get a path relative to  the working directory use getTestPath(). To get a
#     path to test data use getDataPath().
# 
#     The working directory is cleared after every test so there is no need to do
#     it manually within your tests.
#     """
# 
#     def setUp(self):
#         self.sandbox = FileSystemSandbox()
#         self.sandbox.enable(self.getWorkingDir())
#         self.clearWorkingDirectory()
# 
#     def tearDown(self):
#         self.clearWorkingDirectory()
#         self.sandbox.disable()
# 
#     @classmethod
#     def getMyDir(self):
#         return os.path.dirname(__file__)
# 
#     @classmethod
#     def getTestPath(self, path):
#         "Returns path prepended by the working directory"
#         fullPath = os.path.join(self.getWorkingDir(), path)
#         return os.path.normpath(fullPath)
# 
#     @classmethod
#     def getDataPath(self, path):
#         "Returns path prepended by the test data directory"
#         dataDir = 'data'
#         fullPath = os.path.join(self.getMyDir(), dataDir, path)
#         return os.path.normpath(fullPath)
# 
#     @classmethod
#     def getWorkingDir(self):
#         """"Returns the path to a directory where we can safely create files and
#         directories during tests"""
#         dirName = 'workingDir'
#         return os.path.join(self.getMyDir(), dirName)
# 
#     def copyDataToWorkingDir(self, dataSrc, workingDirDest):
#         "Copies a file or dir from the data directory to the working directory"
#         dataSrc = self.getDataPath(dataSrc)
#         workingDirDest = self.getTestPath(workingDirDest)
#         if os.path.isdir(dataSrc):
#             shutil.copytree(dataSrc, workingDirDest)
#         else:
#             shutil.copy(dataSrc, workingDirDest)
# 
#     def clearWorkingDirectory(self):
#         for entry in os.listdir(self.getWorkingDir()):
#             fullPath = os.path.join(self.getWorkingDir(), entry)
#             if os.path.isfile(fullPath):
#                 # If file is readonly, make it writable
#                 if not os.access(fullPath, os.W_OK):
#                     os.chmod(fullPath, stat.S_IWRITE)
#                 os.remove(fullPath)
#             elif os.path.isdir(fullPath):
#                 shutil.rmtree(fullPath, onerror=_remove_readonly)
# 
# Path: vimswitch/Settings.py
# class Settings:
# 
#     def __init__(self, homePath=''):
#         """
#         homePath is used as the prefix for all other paths. If homePath is not
#         specified it gets set to the user's home directory.
#         """
#         self.homePath = homePath or os.path.expanduser('~')
#         self.configPath = os.path.join(self.homePath, '.vimswitch')
#         self.configFilePath = os.path.join(self.configPath, 'vimswitchrc')
#         self.cachePath = os.path.join(self.configPath, 'profiles')
#         self.downloadsPath = os.path.join(self.configPath, 'downloads')
#         self.profileFiles = ['.vimrc', '_vimrc']
#         self.profileDirs = ['.vim', '_vim']
#         self.defaultProfile = Profile('default')
#         self.currentProfile = None
# 
#     def __eq__(self, other):
#         return self.__dict__ == other.__dict__
# 
# Path: vimswitch/DiskIo.py
# def getDiskIo(app):
#     return app.get('diskIo', createDiskIo(app))
# 
# Path: vimswitch/ApplicationDirs.py
# def getApplicationDirs(app):
#     return app.get('applicationDirs', createApplicationDirs(app))
# 
# Path: vimswitch/Application.py
# class Application:
#     """
#     A container for components that are used application-wide.
# 
#     Examples of how this class can be used:
# 
#       - Set a component
#         `app.foo = myFoo`
# 
#       - Get (or create) a component:
#         `foo = app.get('foo', Foo())`
#         This will try to return `app.foo`. If that does not exist, then it will
#         set `app.foo = Foo()` and return that instead.
# 
#       - Get an already created component
#         `foo = app.foo`
#         Use this when you are sure that app.foo has already been set
#     """
# 
#     def get(self, attr, default):
#         """
#         Returns self.attr. If attr does not exist, then make self.attr = default
#         and then return default.
#         """
#         if hasattr(self, attr):
#             return getattr(self, attr)
#         else:
#             setattr(self, attr, default)
#             return default


from .FileSystemTestCase import FileSystemTestCase
from vimswitch.Settings import Settings
from vimswitch.DiskIo import getDiskIo
from vimswitch.ApplicationDirs import getApplicationDirs
from vimswitch.Application import Application


class TestApplicationDirs(FileSystemTestCase):
    def setUp(self):
        FileSystemTestCase.setUp(self)
        app = Application()

# Path: vimswitch/test/FileSystemTestCase.py
# class FileSystemTestCase(BaseTestCase):
#     """
#     Inherit from this class when a unit test needs to access the disk. This
#     class sets up a sandbox so that disk modifications only occur within a
#     working directory. This keeps test code from affecting other files on the
#     system.
# 
#     To get a path relative to  the working directory use getTestPath(). To get a
#     path to test data use getDataPath().
# 
#     The working directory is cleared after every test so there is no need to do
#     it manually within your tests.
#     """
# 
#     def setUp(self):
#         self.sandbox = FileSystemSandbox()
#         self.sandbox.enable(self.getWorkingDir())
#         self.clearWorkingDirectory()
# 
#     def tearDown(self):
#         self.clearWorkingDirectory()
#         self.sandbox.disable()
# 
#     @classmethod
#     def getMyDir(self):
#         return os.path.dirname(__file__)
# 
#     @classmethod
#     def getTestPath(self, path):
#         "Returns path prepended by the working directory"
#         fullPath = os.path.join(self.getWorkingDir(), path)
#         return os.path.normpath(fullPath)
# 
#     @classmethod
#     def getDataPath(self, path):
#         "Returns path prepended by the test data directory"
#         dataDir = 'data'
#         fullPath = os.path.join(self.getMyDir(), dataDir, path)
#         return os.path.normpath(fullPath)
# 
#     @classmethod
#     def getWorkingDir(self):
#         """"Returns the path to a directory where we can safely create files and
#         directories during tests"""
#         dirName = 'workingDir'
#         return os.path.join(self.getMyDir(), dirName)
# 
#     def copyDataToWorkingDir(self, dataSrc, workingDirDest):
#         "Copies a file or dir from the data directory to the working directory"
#         dataSrc = self.getDataPath(dataSrc)
#         workingDirDest = self.getTestPath(workingDirDest)
#         if os.path.isdir(dataSrc):
#             shutil.copytree(dataSrc, workingDirDest)
#         else:
#             shutil.copy(dataSrc, workingDirDest)
# 
#     def clearWorkingDirectory(self):
#         for entry in os.listdir(self.getWorkingDir()):
#             fullPath = os.path.join(self.getWorkingDir(), entry)
#             if os.path.isfile(fullPath):
#                 # If file is readonly, make it writable
#                 if not os.access(fullPath, os.W_OK):
#                     os.chmod(fullPath, stat.S_IWRITE)
#                 os.remove(fullPath)
#             elif os.path.isdir(fullPath):
#                 shutil.rmtree(fullPath, onerror=_remove_readonly)
# 
# Path: vimswitch/Settings.py
# class Settings:
# 
#     def __init__(self, homePath=''):
#         """
#         homePath is used as the prefix for all other paths. If homePath is not
#         specified it gets set to the user's home directory.
#         """
#         self.homePath = homePath or os.path.expanduser('~')
#         self.configPath = os.path.join(self.homePath, '.vimswitch')
#         self.configFilePath = os.path.join(self.configPath, 'vimswitchrc')
#         self.cachePath = os.path.join(self.configPath, 'profiles')
#         self.downloadsPath = os.path.join(self.configPath, 'downloads')
#         self.profileFiles = ['.vimrc', '_vimrc']
#         self.profileDirs = ['.vim', '_vim']
#         self.defaultProfile = Profile('default')
#         self.currentProfile = None
# 
#     def __eq__(self, other):
#         return self.__dict__ == other.__dict__
# 
# Path: vimswitch/DiskIo.py
# def getDiskIo(app):
#     return app.get('diskIo', createDiskIo(app))
# 
# Path: vimswitch/ApplicationDirs.py
# def getApplicationDirs(app):
#     return app.get('applicationDirs', createApplicationDirs(app))
# 
# Path: vimswitch/Application.py
# class Application:
#     """
#     A container for components that are used application-wide.
# 
#     Examples of how this class can be used:
# 
#       - Set a component
#         `app.foo = myFoo`
# 
#       - Get (or create) a component:
#         `foo = app.get('foo', Foo())`
#         This will try to return `app.foo`. If that does not exist, then it will
#         set `app.foo = Foo()` and return that instead.
# 
#       - Get an already created component
#         `foo = app.foo`
#         Use this when you are sure that app.foo has already been set
#     """
# 
#     def get(self, attr, default):
#         """
#         Returns self.attr. If attr does not exist, then make self.attr = default
#         and then return default.
#         """
#         if hasattr(self, attr):
#             return getattr(self, attr)
#         else:
#             setattr(self, attr, default)
#             return default


# Path: vimswitch/test/test_ApplicationDirs.py
from .FileSystemTestCase import FileSystemTestCase
from vimswitch.Settings import Settings
from vimswitch.DiskIo import getDiskIo
from vimswitch.ApplicationDirs import getApplicationDirs
from vimswitch.Application import Application



class TestApplicationDirs(FileSystemTestCase):
    def setUp(self):
        FileSystemTestCase.setUp(self)
        app = Application()

        app.settings = Settings(self.getWorkingDir())