Beispiel #1
0
    def init_environment(self,
                         test_dir=System.get_long_path(tempfile.mkdtemp()),
                         curr_dir=None):
        self._test_dir = System.realpath(test_dir)
        self._proj_dir = 'proj'
        self._test_git_dir = os.path.join(self._test_dir, self._proj_dir)
        self._old_curr_dir_abs = System.realpath(os.curdir)

        if os.path.exists(self._test_dir):
            rmtree(self._test_dir)

        if curr_dir:
            self._curr_dir = System.realpath(curr_dir)
        else:
            self._curr_dir = self._test_git_dir

        if not os.path.exists(self._curr_dir):
            os.makedirs(self._curr_dir)

        if not os.path.isdir(self._test_git_dir):
            os.makedirs(self._test_git_dir)

        data_dir = os.path.join(self._test_git_dir, 'data')
        cache_dir = os.path.join(self._test_git_dir, ConfigI.CONFIG_DIR,
                                 ConfigI.CACHE_DIR)
        state_dir = os.path.join(self._test_git_dir, ConfigI.CONFIG_DIR,
                                 ConfigI.STATE_DIR)

        os.makedirs(data_dir)
        os.makedirs(cache_dir)
        os.makedirs(state_dir)

        os.chdir(self._curr_dir)
Beispiel #2
0
    def setUp(self):
        self.test_dir = System.get_long_path(tempfile.mkdtemp())
        self._old_curr_dir_abs = System.realpath(os.curdir)

        self.tearDown()
        os.mkdir(self.test_dir)
        os.chdir(self.test_dir)
        os.mkdir('data')

        self._devnull = open(os.devnull, 'w')
        subprocess.Popen(['git', 'init'], stdout=self._devnull,
                         stderr=None).wait()

        self.git = GitWrapperI(self.test_dir)
        self.config = ConfigI()
        self.path_factory = PathFactory(self.git, self.config)
        self.settings = Settings([], self.git, self.config)
Beispiel #3
0
    def setUp(self):
        self.test_dir = System.get_long_path(tempfile.mkdtemp())
        self._old_curr_dir_abs = System.realpath(os.curdir)

        self.tearDown()
        os.mkdir(self.test_dir)
        os.chdir(self.test_dir)
        os.mkdir('data')
        os.mkdir('cache')
        os.mkdir('state')

        self.init_git_repo()
        self.git = GitWrapper()

        self.config = ConfigI('data', 'cache', 'state')
        self.path_factory = PathFactory(self.git, self.config)

        self.settings = Settings([], self.git, self.config)
        pass
Beispiel #4
0
    def setUp(self):
        self.test_dir = System.get_long_path(tempfile.mkdtemp())
        self._old_curr_dir_abs = System.realpath(os.curdir)

        self.tearDown()
        os.mkdir(self.test_dir)
        os.chdir(self.test_dir)
        os.mkdir('data')
        os.mkdir(ConfigI.CONFIG_DIR)
        os.mkdir(os.path.join(ConfigI.CONFIG_DIR, ConfigI.CACHE_DIR_NAME))
        os.mkdir(os.path.join(ConfigI.CONFIG_DIR, ConfigI.STATE_DIR_NAME))

        self.init_git_repo()
        self.git = GitWrapper()

        self.config = ConfigI('data')
        self.path_factory = PathFactory(self.git, self.config)

        self.settings = Settings('run cmd', self.git, self.config)
        pass
Beispiel #5
0
 def setUp(self):
     self._root_dir = System.get_long_path(tempfile.mkdtemp())
     self._pushd(self._root_dir)
     self.create(self.FOO, self.FOO_CONTENTS)
     self.create(self.BAR, self.BAR_CONTENTS)
     self.create(self.CODE, self.CODE_CONTENTS)