mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Keep original test as is
This commit is contained in:
parent
4d0c400066
commit
e5b8cb0f70
1 changed files with 21 additions and 3 deletions
|
|
@ -114,6 +114,26 @@ def test_autoupdate_out_of_date_repo(
|
||||||
)
|
)
|
||||||
write_config('.', config)
|
write_config('.', config)
|
||||||
|
|
||||||
|
runner = Runner('.', C.CONFIG_FILE)
|
||||||
|
before = open(C.CONFIG_FILE).read()
|
||||||
|
# It will update the repo, because the name matches
|
||||||
|
ret = autoupdate(runner, tags_only=False)
|
||||||
|
after = open(C.CONFIG_FILE).read()
|
||||||
|
assert ret == 0
|
||||||
|
assert before != after
|
||||||
|
# Make sure we don't add defaults
|
||||||
|
assert 'exclude' not in after
|
||||||
|
assert out_of_date_repo.head_sha in after
|
||||||
|
|
||||||
|
def test_autoupdate_out_of_date_repo_with_correct_repo_name(
|
||||||
|
out_of_date_repo, in_tmpdir, mock_out_store_directory,
|
||||||
|
):
|
||||||
|
# Write out the config
|
||||||
|
config = make_config_from_repo(
|
||||||
|
out_of_date_repo.path, sha=out_of_date_repo.original_sha, check=False,
|
||||||
|
)
|
||||||
|
write_config('.', config)
|
||||||
|
|
||||||
runner = Runner('.', C.CONFIG_FILE)
|
runner = Runner('.', C.CONFIG_FILE)
|
||||||
before = open(C.CONFIG_FILE).read()
|
before = open(C.CONFIG_FILE).read()
|
||||||
repo_name = 'file://{}'.format(out_of_date_repo.path)
|
repo_name = 'file://{}'.format(out_of_date_repo.path)
|
||||||
|
|
@ -126,8 +146,7 @@ def test_autoupdate_out_of_date_repo(
|
||||||
assert 'exclude' not in after
|
assert 'exclude' not in after
|
||||||
assert out_of_date_repo.head_sha in after
|
assert out_of_date_repo.head_sha in after
|
||||||
|
|
||||||
|
def test_autoupdate_out_of_date_repo_with_wrong_repo_name(
|
||||||
def test_autoupdate_out_of_date_repo_wrong_repo_name(
|
|
||||||
out_of_date_repo, in_tmpdir, mock_out_store_directory,
|
out_of_date_repo, in_tmpdir, mock_out_store_directory,
|
||||||
):
|
):
|
||||||
# Write out the config
|
# Write out the config
|
||||||
|
|
@ -144,7 +163,6 @@ def test_autoupdate_out_of_date_repo_wrong_repo_name(
|
||||||
assert ret == 0
|
assert ret == 0
|
||||||
assert before == after
|
assert before == after
|
||||||
|
|
||||||
|
|
||||||
def test_does_not_reformat(
|
def test_does_not_reformat(
|
||||||
out_of_date_repo, mock_out_store_directory, in_tmpdir,
|
out_of_date_repo, mock_out_store_directory, in_tmpdir,
|
||||||
):
|
):
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue