def test_new_branch_tags(tmpdir, local_light, fail):
"""Test with new branches and tags unknown to local repo.
:param tmpdir: pytest fixture.
:param local_light: conftest fixture.
:param bool fail: Fail by not fetching.
"""
remotes = [r for r in list_remote(str(local_light)) if r[1] == 'ob_at']
# Fail.
sha = remotes[0][0]
target = tmpdir.ensure_dir('exported', sha)
if fail:
with pytest.raises(CalledProcessError):
export(str(local_light), sha, str(target))
return
# Fetch.
fetch_commits(str(local_light), remotes)
# Export.
export(str(local_light), sha, str(target))
files = [f.relto(target) for f in target.listdir()]
assert files == ['README']
assert target.join('README').read() == 'new'
评论列表
文章目录