# 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/DiskIo.py
# class DiskIo:
# 
#     def createFile(self, filePath, contents):
#         with open(filePath, 'w') as file:
#             file.write(contents)
# 
#     def getFileContents(self, filePath):
#         with open(filePath, 'r') as file:
#             return file.read()
# 
#     def copyFile(self, srcPath, destPath):
#         shutil.copy(srcPath, destPath)
# 
#     def move(self, srcPath, destPath):
#         shutil.move(srcPath, destPath)
# 
#     def deleteFile(self, filePath):
#         os.remove(filePath)
# 
#     def fileExists(self, filePath):
#         return os.path.isfile(filePath)
# 
#     def createDir(self, dirPath):
#         return os.mkdir(dirPath)
# 
#     def createDirWithParents(self, dirPath):
#         return os.makedirs(dirPath)
# 
#     def copyDir(self, srcPath, destPath):
#         """
#         Recursively copies the src directory to a new dest directory. Creates
#         the parent directories of the destination if required.
# 
#         Raises OSError if the destination directory already exists.
#         """
#         return shutil.copytree(srcPath, destPath)
# 
#     def deleteDir(self, dirPath):
#         """
#         Recursively delete a directory. Read-only files inside the directory
#         will also be deleted.
#         """
#         shutil.rmtree(dirPath, onerror=self._remove_readonly)
# 
#     def dirExists(self, dirPath):
#         return os.path.isdir(dirPath)
# 
#     def isDirEmpty(self, dirPath):
#         return len(os.listdir(dirPath)) == 0
# 
#     def getDirContents(self, dirPath):
#         return os.listdir(dirPath)
# 
#     def anyExists(self, path):
#         return self.fileExists(path) or self.dirExists(path)
# 
#     def setReadOnly(self, path, readOnly):
#         st = os.stat(path)
#         if readOnly:
#             os.chmod(path, st.st_mode & ~stat.S_IWRITE)
#         else:
#             os.chmod(path, st.st_mode | stat.S_IWRITE)
# 
#     def isReadOnly(self, path):
#         mode = os.stat(path)[stat.ST_MODE]
#         return not mode & stat.S_IWRITE
# 
#     # Private
# 
#     def _remove_readonly(self, func, path, excinfo):
#         os.chmod(path, stat.S_IWRITE)
#         func(path)


from .FileSystemTestCase import FileSystemTestCase
from vimswitch.DiskIo import DiskIo
from zipfile import ZipFile


class TestZipFile(FileSystemTestCase):
    def setUp(self):
        FileSystemTestCase.setUp(self)

# 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/DiskIo.py
# class DiskIo:
# 
#     def createFile(self, filePath, contents):
#         with open(filePath, 'w') as file:
#             file.write(contents)
# 
#     def getFileContents(self, filePath):
#         with open(filePath, 'r') as file:
#             return file.read()
# 
#     def copyFile(self, srcPath, destPath):
#         shutil.copy(srcPath, destPath)
# 
#     def move(self, srcPath, destPath):
#         shutil.move(srcPath, destPath)
# 
#     def deleteFile(self, filePath):
#         os.remove(filePath)
# 
#     def fileExists(self, filePath):
#         return os.path.isfile(filePath)
# 
#     def createDir(self, dirPath):
#         return os.mkdir(dirPath)
# 
#     def createDirWithParents(self, dirPath):
#         return os.makedirs(dirPath)
# 
#     def copyDir(self, srcPath, destPath):
#         """
#         Recursively copies the src directory to a new dest directory. Creates
#         the parent directories of the destination if required.
# 
#         Raises OSError if the destination directory already exists.
#         """
#         return shutil.copytree(srcPath, destPath)
# 
#     def deleteDir(self, dirPath):
#         """
#         Recursively delete a directory. Read-only files inside the directory
#         will also be deleted.
#         """
#         shutil.rmtree(dirPath, onerror=self._remove_readonly)
# 
#     def dirExists(self, dirPath):
#         return os.path.isdir(dirPath)
# 
#     def isDirEmpty(self, dirPath):
#         return len(os.listdir(dirPath)) == 0
# 
#     def getDirContents(self, dirPath):
#         return os.listdir(dirPath)
# 
#     def anyExists(self, path):
#         return self.fileExists(path) or self.dirExists(path)
# 
#     def setReadOnly(self, path, readOnly):
#         st = os.stat(path)
#         if readOnly:
#             os.chmod(path, st.st_mode & ~stat.S_IWRITE)
#         else:
#             os.chmod(path, st.st_mode | stat.S_IWRITE)
# 
#     def isReadOnly(self, path):
#         mode = os.stat(path)[stat.ST_MODE]
#         return not mode & stat.S_IWRITE
# 
#     # Private
# 
#     def _remove_readonly(self, func, path, excinfo):
#         os.chmod(path, stat.S_IWRITE)
#         func(path)


# Path: vimswitch/test/test_ZipFile.py
from .FileSystemTestCase import FileSystemTestCase
from vimswitch.DiskIo import DiskIo
from zipfile import ZipFile



class TestZipFile(FileSystemTestCase):
    def setUp(self):
        FileSystemTestCase.setUp(self)

        self.diskIo = DiskIo()