def test_repository_is_created(self): temp_path = tempfile.mkdtemp() repo = Repository.clone("git://github.com/heynemann/wight.git", temp_path) expect(repo.is_empty).to_be_false() expect(repo.is_bare).to_be_false() bench_path = join(temp_path, 'bench') expect(exists(bench_path)).to_be_true() conf_path = join(bench_path, 'wight.yml') expect(exists(conf_path)).to_be_true()
def test_from_pygit(self): directory = mkdtemp() repo = Repository.clone(url="git://github.com/heynemann/wight.git", path=directory) head_commit = tuple(repo.walk(repo.head.target, GIT_SORT_TIME))[0] commit = Commit.from_pygit(head_commit) commit_date = datetime.datetime.fromtimestamp(head_commit.commit_time) expect(commit.hex).to_equal(head_commit.hex) expect(commit.author_name).to_equal(head_commit.author.name) expect(commit.author_email).to_equal(head_commit.author.email) expect(commit.committer_name).to_equal(head_commit.committer.name) expect(commit.committer_email).to_equal(head_commit.committer.email) expect(commit.commit_date).to_equal(commit_date)
def _clone_repository(self, base_path, load_test): repo = Repository.clone(url=load_test.project.repository, path=base_path, branch=load_test.git_branch) self._save_last_commit(load_test, repo) return repo