Esempio n. 1
0
 def create(self):
     if not exists(self.checkout_dir):
         self._logger.debug("Create checkout directory %s", self.checkout_dir)
         makedirs(self.checkout_dir)
     if not listdir(self.checkout_dir):
         self._logger.debug("Copy from %s", self.url)
         copy_tree(self.url, self.checkout_dir)
Esempio n. 2
0
    def test_copies_empty_directory(self):
        src = join(self.temp_dir, "src")
        makedirs(join(src, "empty"))

        copy_tree(src, self.temp_dir)

        assert exists(join(self.temp_dir, "empty"))
Esempio n. 3
0
    def test_copy_creates_destination(self):
        src = join(self.temp_dir, "src")
        makedirs(src)

        dst = join(self.temp_dir, "dst")
        copy_tree(src, dst)

        assert exists(dst)
Esempio n. 4
0
    def test_copies_tree(self):
        src = join(self.temp_dir, "src")
        file1 = join("dir1", "dir2", "file1")
        file2 = join("dir1", "file2")
        file3 = join("file3")
        create_file(join(src, file1))
        create_file(join(src, file2))
        create_file(join(src, file3))

        copy_tree(src, self.temp_dir)

        assert exists(join(self.temp_dir, file1))
        assert exists(join(self.temp_dir, file2))
        assert exists(join(self.temp_dir, file3))
Esempio n. 5
0
 def __copy_additional_compile_sources(version: ProjectVersion, checkout_dir: str):
     additional_sources = version.additional_compile_sources
     if exists(additional_sources):
         copy_tree(additional_sources, checkout_dir)
Esempio n. 6
0
 def __clean_copy(sources_path: str, destination: str):
     remove_tree(destination)
     copy_tree(sources_path, destination)
Esempio n. 7
0
    def test_exists(self):
        uut = GitProjectCheckout(self.git_url, self.checkouts_dir, "-project-", "-id-", "HEAD")
        copy_tree(self.git_url, uut.checkout_dir)

        assert uut.exists()
Esempio n. 8
0
 def test_copy_fails_if_source_misssing(self):
     src = join(self.temp_dir, "src")
     with assert_raises(FileNotFoundError):
         copy_tree(src, "-irrelevant-")