Improve git_commit helper

This commit is contained in:
Anthony Sottile 2018-12-28 15:13:06 -08:00
parent 28c97a95cd
commit 160a11a0a7
10 changed files with 75 additions and 84 deletions

View file

@ -60,11 +60,11 @@ def test_autoupdate_old_revision_broken(tempdir_factory, in_tmpdir, store):
config = make_config_from_repo(path, check=False)
cmd_output('git', 'mv', C.MANIFEST_FILE, 'nope.yaml', cwd=path)
git_commit('simulate old repo', cwd=path)
git_commit(cwd=path)
# Assume this is the revision the user's old repository was at
rev = git.head_rev(path)
cmd_output('git', 'mv', 'nope.yaml', C.MANIFEST_FILE, cwd=path)
git_commit('move hooks file', cwd=path)
git_commit(cwd=path)
update_rev = git.head_rev(path)
config['rev'] = rev
@ -84,8 +84,7 @@ def out_of_date_repo(tempdir_factory):
path = make_repo(tempdir_factory, 'python_hooks_repo')
original_rev = git.head_rev(path)
# Make a commit
git_commit('foo', cwd=path)
git_commit(cwd=path)
head_rev = git.head_rev(path)
yield auto_namedtuple(
@ -240,7 +239,7 @@ def test_autoupdate_tagged_repo(tagged_repo, in_tmpdir, store):
@pytest.fixture
def tagged_repo_with_more_commits(tagged_repo):
git_commit('foo', cwd=tagged_repo.path)
git_commit(cwd=tagged_repo.path)
yield tagged_repo
@ -263,8 +262,8 @@ def test_autoupdate_latest_no_config(out_of_date_repo, in_tmpdir, store):
)
write_config('.', config)
cmd_output('git', '-C', out_of_date_repo.path, 'rm', '-r', ':/')
git_commit('rm', config=out_of_date_repo.path)
cmd_output('git', 'rm', '-r', ':/', cwd=out_of_date_repo.path)
git_commit(cwd=out_of_date_repo.path)
ret = autoupdate(C.CONFIG_FILE, store, tags_only=False)
assert ret == 1
@ -282,7 +281,7 @@ def hook_disappearing_repo(tempdir_factory):
os.path.join(path, C.MANIFEST_FILE),
)
cmd_output('git', 'add', '.', cwd=path)
git_commit('Remove foo', cwd=path)
git_commit(cwd=path)
yield auto_namedtuple(path=path, original_rev=original_rev)