From 427ccc61f74b997bbe489cfac84b58e33dc44c3a Mon Sep 17 00:00:00 2001 From: Mehdi ABAAKOUK Date: Wed, 20 Nov 2024 09:21:46 +0100 Subject: [PATCH] fix(stack-setup): put hooks at the right place (#549) This adds test coverage to stack_setup to ensure we don't break this again. --- mergify_cli/{ => stack}/hooks/commit-msg | 0 mergify_cli/tests/stack/test_setup.py | 20 ++++++++++++++++++++ 2 files changed, 20 insertions(+) rename mergify_cli/{ => stack}/hooks/commit-msg (100%) create mode 100644 mergify_cli/tests/stack/test_setup.py diff --git a/mergify_cli/hooks/commit-msg b/mergify_cli/stack/hooks/commit-msg similarity index 100% rename from mergify_cli/hooks/commit-msg rename to mergify_cli/stack/hooks/commit-msg diff --git a/mergify_cli/tests/stack/test_setup.py b/mergify_cli/tests/stack/test_setup.py new file mode 100644 index 0000000..5498cbd --- /dev/null +++ b/mergify_cli/tests/stack/test_setup.py @@ -0,0 +1,20 @@ +import pathlib +import typing + +import pytest + +from mergify_cli.stack import setup +from mergify_cli.tests import utils as test_utils + + +async def test_setup( + git_mock: test_utils.GitMock, + tmp_path: pytest.TempdirFactory, +) -> None: + hooks_dir = typing.cast(pathlib.Path, tmp_path) / ".git" / "hooks" + hooks_dir.mkdir(parents=True) + git_mock.mock("rev-parse", "--git-path", "hooks", output=str(hooks_dir)) + await setup.stack_setup() + + hook = hooks_dir / "commit-msg" + assert hook.exists()