(tmpdir, tempdir_factory, store, cap_out)
| 17 | |
| 18 | |
| 19 | def test_init_templatedir(tmpdir, tempdir_factory, store, cap_out): |
| 20 | target = str(tmpdir.join('tmpl')) |
| 21 | init_templatedir(C.CONFIG_FILE, store, target, hook_types=['pre-commit']) |
| 22 | lines = cap_out.get().splitlines() |
| 23 | assert lines[0].startswith('pre-commit installed at ') |
| 24 | assert lines[1] == ( |
| 25 | '[WARNING] `init.templateDir` not set to the target directory' |
| 26 | ) |
| 27 | assert lines[2].startswith( |
| 28 | '[WARNING] maybe `git config --global init.templateDir', |
| 29 | ) |
| 30 | |
| 31 | with envcontext((('GIT_TEMPLATE_DIR', target),)): |
| 32 | path = make_consuming_repo(tempdir_factory, 'script_hooks_repo') |
| 33 | |
| 34 | with cwd(path): |
| 35 | retcode, output = git_commit( |
| 36 | fn=cmd_output_mocked_pre_commit_home, |
| 37 | tempdir_factory=tempdir_factory, |
| 38 | ) |
| 39 | assert retcode == 0 |
| 40 | assert 'Bash hook....' in output |
| 41 | |
| 42 | |
| 43 | def test_init_templatedir_already_set(tmpdir, tempdir_factory, store, cap_out): |
nothing calls this directly
no test coverage detected