Skip to content

Commit 8a7142d

Browse files
authored
Added test for blank configuration file
1 parent f2be2ea commit 8a7142d

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

tests/commands/migrate_config_test.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,3 +147,12 @@ def test_migrate_config_sha_to_rev(tmpdir):
147147
' rev: v1.2.0\n'
148148
' hooks: []\n'
149149
)
150+
151+
@pytest.mark.parametrize('contents', ('', '\n'))
152+
def test_empty_configuration_file_user_error(tmpdir, contents):
153+
cfg = tmpdir.join(C.CONFIG_FILE)
154+
cfg.write(contents)
155+
with tmpdir.as_cwd():
156+
assert not migrate_config(C.CONFIG_FILE)
157+
# even though the config is invalid, this should be a noop
158+
assert cfg.read() == contents

0 commit comments

Comments
 (0)