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)
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"))
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)
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))
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)
def __clean_copy(sources_path: str, destination: str): remove_tree(destination) copy_tree(sources_path, destination)
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()
def test_copy_fails_if_source_misssing(self): src = join(self.temp_dir, "src") with assert_raises(FileNotFoundError): copy_tree(src, "-irrelevant-")