Skip to content

Commit 944a43c

Browse files
committed
Make HookTestCaseBase.test_install_already_exists use repo.git_dir
This should make the test work with worktrees
1 parent 63748ba commit 944a43c

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

tests/test_hook.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ def test_install_twice(self):
5959
self.assertEqual(output.strip(), 'The hook is already installed.')
6060

6161
def test_install_already_exists(self):
62-
self.repo.write_file(os.path.join('.git', 'hooks', 'pre-commit'), '')
62+
with open(os.path.join(self.repo.git_dir, 'hooks', 'pre-commit'), 'w') as pre_commit_file:
63+
pre_commit_file.write('echo "Dummy"')
6364

6465
res, _ = self.install(allow_errors=True)
6566
self.assertFalse(res)

0 commit comments

Comments
 (0)