From 39470c98caa07e92c1098633bd4bd48fac59f98d Mon Sep 17 00:00:00 2001 From: Anthony Sottile Date: Mon, 16 Jun 2014 13:03:00 -0700 Subject: [PATCH] Add expected behaviour for failure to find pre_commit. --- tests/commands/install_test.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tests/commands/install_test.py b/tests/commands/install_test.py index aa6bd8b9..965d5803 100644 --- a/tests/commands/install_test.py +++ b/tests/commands/install_test.py @@ -71,3 +71,21 @@ def test_install_idempotent(tmpdir_factory): output = _get_commit_output(tmpdir_factory) assert NORMAL_PRE_COMMIT_RUN.match(output) + + +def test_environment_not_sourced(tmpdir_factory): + path = make_consuming_repo(tmpdir_factory, 'script_hooks_repo') + with local.cwd(path): + assert install(Runner(path)) == 0 + + ret, stdout, stderr = local['git'].run( + ['commit', '--allow-empty', '-m', 'foo'], + env={}, + retcode=None, + ) + assert ret == 1 + assert stdout == '' + assert stderr == ( + '`pre-commit` not found. ' + 'Did you forget to activate your virtualenv?\n' + )