mirror of
https://github.com/pre-commit/pre-commit.git
synced 2026-02-17 08:14:42 +04:00
Added test for blank configuration file
This commit is contained in:
parent
f2be2ead35
commit
8a7142d763
1 changed files with 9 additions and 0 deletions
|
|
@ -147,3 +147,12 @@ def test_migrate_config_sha_to_rev(tmpdir):
|
|||
' rev: v1.2.0\n'
|
||||
' hooks: []\n'
|
||||
)
|
||||
|
||||
@pytest.mark.parametrize('contents', ('', '\n'))
|
||||
def test_empty_configuration_file_user_error(tmpdir, contents):
|
||||
cfg = tmpdir.join(C.CONFIG_FILE)
|
||||
cfg.write(contents)
|
||||
with tmpdir.as_cwd():
|
||||
assert not migrate_config(C.CONFIG_FILE)
|
||||
# even though the config is invalid, this should be a noop
|
||||
assert cfg.read() == contents
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue