Ejemplo n.º 1
0
    def setUp(self):
        BasicEnvironment.init_environment(self, test_dir=os.path.join(os.path.sep, 'tmp', 'ntx_unit_test'))

        git = GitWrapperI(git_dir=self._test_git_dir, commit='ad45ba8')
        config = ConfigI()

        file = os.path.join('data', 'file.txt')
        self.cache_file_full_path = os.path.join(self._test_git_dir, ConfigI.CONFIG_DIR, ConfigI.CACHE_DIR_NAME, 'file.txt_ad45ba8')
        self._data_path = DataItem(file, git, config, cache_file=self.cache_file_full_path)
        pass
Ejemplo n.º 2
0
    def setUp(self):
        BasicEnvironment.init_environment(self, test_dir=os.path.join(os.path.sep, 'tmp', 'ntx_unit_test'))

        self._git = GitWrapperI(git_dir=self._test_git_dir, commit='ad45ba8')
        self._config = ConfigI('data')

        self._file = os.path.join('data', 'dir1', 'file.txt')
        self._cache = os.path.join(ConfigI.CONFIG_DIR, ConfigI.CACHE_DIR_NAME, 'dir1', 'file.txt_abcd')

        self._data_item = DataItem(self._file, self._git, self._config, self._cache)
        pass
Ejemplo n.º 3
0
    def setUp(self):
        BasicEnvironment.init_environment(self,
                                          test_dir=os.path.join(
                                              os.path.sep, 'tmp',
                                              'ntx_unit_test'))

        git = GitWrapperI(git_dir=self._test_git_dir, commit='ad45ba8')
        config = ConfigI('data', 'cache', 'state')

        file = os.path.join('data', 'file.txt')
        self._data_path = DataItem(file, git, config)
        pass
Ejemplo n.º 4
0
    def to_data_items(self, files):
        result = []
        externally_created_files = []

        for file in files:
            try:
                data_item = DataItem(file, self._git, self._config)
                result.append(data_item)
            except NotInDataDirError:
                externally_created_files.append(file)

        return result, externally_created_files
Ejemplo n.º 5
0
 def existing_data_item(self, file):
     if not os.path.islink(file):
         raise DataItemError(u'Data file "%s" must be a symbolic link' % file)
     resolved_symlink = os.path.realpath(file)
     return DataItem(file, self._git, self._config, resolved_symlink)
Ejemplo n.º 6
0
 def data_item(self, data_file):
     return DataItem(data_file, self._git, self._config)
Ejemplo n.º 7
0
 def data_item(self, data_file, cache_file=None):
     return DataItem(data_file, self._git, self._config, cache_file)
Ejemplo n.º 8
0
    def existing_data_item(self, fname):
        if not self.is_data_item(fname):
            raise DataItemError(
                u'No state file found for data file {}'.format(fname))

        return DataItem(fname, self._git, self._config)