mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-19 17:14:43 +04:00
Incoroporate PR feedback
* Make config_file a required argument to Runner * Update main.py * Update tests to make them all green New test to test alternate config functionality coming in next commit
This commit is contained in:
parent
f1c00eefe4
commit
f205e6d170
7 changed files with 63 additions and 59 deletions
|
|
@ -45,7 +45,7 @@ def test_autoupdate_up_to_date_repo(
|
|||
|
||||
before = open(C.CONFIG_FILE).read()
|
||||
assert '^$' not in before
|
||||
runner = Runner('.')
|
||||
runner = Runner('.', C.CONFIG_FILE)
|
||||
ret = autoupdate(runner)
|
||||
after = open(C.CONFIG_FILE).read()
|
||||
assert ret == 0
|
||||
|
|
@ -86,7 +86,7 @@ def test_autoupdate_out_of_date_repo(
|
|||
write_config('.', config)
|
||||
|
||||
before = open(C.CONFIG_FILE).read()
|
||||
runner = Runner('.')
|
||||
runner = Runner('.', C.CONFIG_FILE)
|
||||
ret = autoupdate(runner)
|
||||
after = open(C.CONFIG_FILE).read()
|
||||
assert ret == 0
|
||||
|
|
@ -111,7 +111,7 @@ def test_autoupdate_tagged_repo(
|
|||
)
|
||||
write_config('.', config)
|
||||
|
||||
ret = autoupdate(Runner('.'))
|
||||
ret = autoupdate(Runner('.', C.CONFIG_FILE))
|
||||
assert ret == 0
|
||||
assert 'v1.2.3' in open(C.CONFIG_FILE).read()
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ def test_autoupdate_hook_disappearing_repo(
|
|||
write_config('.', config)
|
||||
|
||||
before = open(C.CONFIG_FILE).read()
|
||||
runner = Runner('.')
|
||||
runner = Runner('.', C.CONFIG_FILE)
|
||||
ret = autoupdate(runner)
|
||||
after = open(C.CONFIG_FILE).read()
|
||||
assert ret == 1
|
||||
|
|
@ -167,7 +167,7 @@ def test_autoupdate_local_hooks(tempdir_factory):
|
|||
git_path = git_dir(tempdir_factory)
|
||||
config = config_with_local_hooks()
|
||||
path = add_config_to_repo(git_path, config)
|
||||
runner = Runner(path)
|
||||
runner = Runner(path, C.CONFIG_FILE)
|
||||
assert autoupdate(runner) == 0
|
||||
new_config_writen = load_config(runner.config_file_path)
|
||||
assert len(new_config_writen) == 1
|
||||
|
|
@ -183,7 +183,7 @@ def test_autoupdate_local_hooks_with_out_of_date_repo(
|
|||
local_config = config_with_local_hooks()
|
||||
config = [local_config, stale_config]
|
||||
write_config('.', config)
|
||||
runner = Runner('.')
|
||||
runner = Runner('.', C.CONFIG_FILE)
|
||||
assert autoupdate(runner) == 0
|
||||
new_config_writen = load_config(runner.config_file_path)
|
||||
assert len(new_config_writen) == 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue