def test_repo_clone(self, tmpdir, monkeypatch):
"""Verify that we can clone a repo."""
p = tmpdir.mkdir('test')
path = str(p)
repo = Repo.init(path)
file = p / 'test.txt'
file.write_text(u'Testing', encoding='utf-8')
repo.index.add(['test.txt'])
repo.index.commit('Testing')
def mockclone(x, y):
return path
def mockwait(*args, **kwargs):
return True
monkeypatch.setattr("git.repo.base.Repo.clone", mockclone)
monkeypatch.setattr("git.cmd.Git.AutoInterrupt.wait", mockwait)
result = osa_differ.repo_clone(path,
"http://example.com")
assert result.active_branch.name == 'master'
assert not result.is_dirty()
评论列表
文章目录