Skip to content

Commit 0f41223

Browse files
authored
Integration tests: fix 2 hooktests on windows (#397)
Relates to #93
1 parent 3b2a10d commit 0f41223

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

.github/workflows/checks.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252

5353
- name: Integration tests (GITLINT_QA_USE_SH_LIB=0)
5454
run: |
55-
hatch run qa:integration-tests --ignore qa/test_hooks.py qa
55+
hatch run qa:integration-tests -k "not(test_commit_hook_continue or test_commit_hook_abort or test_commit_hook_edit)" qa
5656
env:
5757
GITLINT_QA_USE_SH_LIB: 0
5858

@@ -134,7 +134,7 @@ jobs:
134134
- name: Integration tests
135135
run: |
136136
hatch run qa:install-local
137-
hatch run qa:integration-tests -k "not (HookTests or test_lint_staged_stdin or test_stdin_file or test_stdin_pipe_empty)" qa
137+
hatch run qa:integration-tests -k "not (test_commit_hook_continue or test_commit_hook_abort or test_commit_hook_edit or test_lint_staged_stdin or test_stdin_file or test_stdin_pipe_empty)" qa
138138
139139
- name: Build test (gitlint)
140140
run: |

qa/test_hooks.py

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,18 +30,16 @@ def setUp(self):
3030

3131
# install git commit-msg hook and assert output
3232
output_installed = gitlint("install-hook", _cwd=self.tmp_git_repo)
33-
expected_installed = (
34-
f"Successfully installed gitlint commit-msg hook in {self.tmp_git_repo}/.git/hooks/commit-msg\n"
35-
)
33+
commit_msg_hook_path = os.path.join(self.tmp_git_repo, ".git", "hooks", "commit-msg")
34+
expected_installed = f"Successfully installed gitlint commit-msg hook in {commit_msg_hook_path}\n"
3635

3736
self.assertEqualStdout(output_installed, expected_installed)
3837

3938
def tearDown(self):
4039
# uninstall git commit-msg hook and assert output
4140
output_uninstalled = gitlint("uninstall-hook", _cwd=self.tmp_git_repo)
42-
expected_uninstalled = (
43-
f"Successfully uninstalled gitlint commit-msg hook from {self.tmp_git_repo}/.git/hooks/commit-msg\n"
44-
)
41+
commit_msg_hook_path = os.path.join(self.tmp_git_repo, ".git", "hooks", "commit-msg")
42+
expected_uninstalled = f"Successfully uninstalled gitlint commit-msg hook from {commit_msg_hook_path}\n"
4543

4644
self.assertEqualStdout(output_uninstalled, expected_uninstalled)
4745
super().tearDown()
@@ -171,10 +169,10 @@ def test_commit_hook_worktree(self):
171169

172170
output_installed = gitlint("install-hook", _cwd=worktree_dir)
173171
expected_hook_path = os.path.join(tmp_git_repo, ".git", "hooks", "commit-msg")
174-
expected_msg = f"Successfully installed gitlint commit-msg hook in {expected_hook_path}\r\n"
175-
self.assertEqual(output_installed, expected_msg)
172+
expected_msg = f"Successfully installed gitlint commit-msg hook in {expected_hook_path}\n"
173+
self.assertEqualStdout(output_installed, expected_msg)
176174

177175
output_uninstalled = gitlint("uninstall-hook", _cwd=worktree_dir)
178176
expected_hook_path = os.path.join(tmp_git_repo, ".git", "hooks", "commit-msg")
179-
expected_msg = f"Successfully uninstalled gitlint commit-msg hook from {expected_hook_path}\r\n"
180-
self.assertEqual(output_uninstalled, expected_msg)
177+
expected_msg = f"Successfully uninstalled gitlint commit-msg hook from {expected_hook_path}\n"
178+
self.assertEqualStdout(output_uninstalled, expected_msg)

0 commit comments

Comments
 (0)