From 8a7142d7632372fe5493aa8bead9723462a9d86b Mon Sep 17 00:00:00 2001 From: Jesse Bona <37656694+jessebona@users.noreply.github.com> Date: Sat, 2 Feb 2019 10:38:04 +1100 Subject: [PATCH] Added test for blank configuration file --- tests/commands/migrate_config_test.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/commands/migrate_config_test.py b/tests/commands/migrate_config_test.py index 8f9153fd..e07f721f 100644 --- a/tests/commands/migrate_config_test.py +++ b/tests/commands/migrate_config_test.py @@ -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