Esempio n. 1
0
    def setUp(self):
        self._test_dir = os.path.join(os.path.sep, 'tmp', 'dvc_unit_test')
        curr_dir = None
        commit = 'abc1234'

        BasicEnvironment.init_environment(self, self._test_dir, curr_dir)

        self._commit = commit

        self._git = GitWrapperI(git_dir=self._test_git_dir,
                                commit=self._commit)
        self._config = ConfigI('data', 'cache', 'state', '.target')
        self.path_factory = PathFactory(self._git, self._config)
        self.settings = Settings(['target'], self._git, self._config)

        os.chdir(self._test_git_dir)

        os.mkdir(os.path.join('data', 'dir1'))
        os.mkdir(os.path.join('cache', 'dir1'))

        self.file1_cache = os.path.join('cache', 'dir1', 'file1')
        self.file1_data = os.path.join('data', 'dir1', 'file1')

        open(self.file1_cache, 'w').write('ddfdff')
        System.symlink(self.file1_cache, self.file1_data)

        self.file2_cache = os.path.join('cache', 'file2')
        self.file2_data = os.path.join('data', 'file2')

        open(self.file2_cache, 'w').write('ddfdff')
        System.symlink(self.file2_cache, self.file2_data)
Esempio n. 2
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
Esempio n. 3
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
Esempio n. 4
0
    def setUp(self):
        BasicEnvironment.init_environment(
            self, os.path.join(os.path.sep, 'tmp', 'ntx_unit_test'))

        git = GitWrapperI(git_dir=self._test_git_dir, commit='eeeff8f')
        self.data_dir = 'da'
        config = ConfigI(self.data_dir, 'ca', 'st')
        self.path_factory = PathFactory(git, config)

        deep_path = os.path.join(self.data_dir, 'dir1', 'd2', 'file.txt')
        self.data_path = self.path_factory.data_item(deep_path)
        pass
Esempio n. 5
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
Esempio n. 6
0
    def setUp(self):
        BasicEnvironment.init_environment(self, os.path.join(os.path.sep, 'tmp', 'ntx_unit_test'))

        git = GitWrapperI(git_dir=self._test_git_dir, commit='eeeff8f')
        self.data_dir = 'da'
        config = ConfigI()
        self.path_factory = PathFactory(git, config)

        deep_path = os.path.join(self.data_dir, 'dir1', 'd2', 'file.txt')
        self.cache_file = os.path.join(self._test_git_dir, ConfigI.CONFIG_DIR, ConfigI.CACHE_DIR_NAME, 'dir1', 'd2', 'file.txt_eeeff8f')
        self.data_path = self.path_factory.data_item(deep_path, cache_file=self.cache_file)
        pass
Esempio n. 7
0
    def setUp(self):
        curr_dir = os.path.join(os.path.sep, 'tmp', 'ntx_unit_test', 'proj',
                                'mydir', 'dd3')

        BasicEnvironment.init_environment(
            self, os.path.join(os.path.sep, 'tmp', 'ntx_unit_test'), curr_dir)

        self._git = GitWrapperI(git_dir=self._test_git_dir, commit='123ed8')
        self._config = ConfigI('data', 'cache', 'state')
        self.path_factory = PathFactory(self._git, self._config)

        self.data_path = self.path_factory.data_item(
            os.path.join('..', '..', 'data', 'file1.txt'))
        pass
Esempio n. 8
0
    def setUp(self):
        self._test_dir = os.path.join(os.path.sep, 'tmp', 'dvc_unit_test')
        curr_dir = None
        commit = 'abc1234'

        BasicEnvironment.init_environment(self, self._test_dir, curr_dir)

        self._commit = commit

        self._git = GitWrapperI(git_dir=self._test_git_dir,
                                commit=self._commit)
        self._config = ConfigI('data', 'cache', 'state')
        self.path_factory = PathFactory(self._git, self._config)
        self.settings = Settings('gc', self._git, self._config)

        self.dir1 = 'dir1'

        self.create_dirs(self.dir1)
Esempio n. 9
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')
        self.path_factory = PathFactory(git, config)

        self.data_file = os.path.join('data', 'file.txt')
        self.cache_file = os.path.join('cache', 'fsymlinc.txt')

        fd = open(self.cache_file, 'w+')
        fd.write('some text')
        fd.close()

        os.chdir('data')
        System.symlink(os.path.join('..', self.cache_file), 'file.txt')
        os.chdir('..')
        pass
Esempio n. 10
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()
        self.path_factory = PathFactory(git, config)

        self.data_file = os.path.join('data', 'file.txt')
        dummy_md5 = 'fsymlinc.txt'
        self.cache_file = os.path.join(ConfigI.CONFIG_DIR, ConfigI.CACHE_DIR_NAME, dummy_md5)
        self.state_file = os.path.join(ConfigI.CONFIG_DIR, ConfigI.STATE_DIR_NAME, 'data', 'file.txt' + DataItem.STATE_FILE_SUFFIX)

        with open(self.cache_file, 'w+') as fd:
            fd.write('some text')

        with open(self.state_file, 'w+') as fd:
            fd.write('{"Md5" : "' + dummy_md5 + '", "Command" : "run", "Cwd" : "dir"}')

        os.chdir('data')
        System.hardlink(os.path.join('..', self.cache_file), 'file.txt')
        os.chdir('..')
        pass
Esempio n. 11
0
    def setUp(self):
        curr_dir = os.path.join(os.path.sep, 'tmp')

        BasicEnvironment.init_environment(
            self, os.path.join(os.path.sep, 'tmp', 'ntx_unit_test'), curr_dir)