Skip to content

Commit

Permalink
Merge pull request #2196 from mgorny/called-once
Browse files Browse the repository at this point in the history
Fix assertions in `test_git_hook`
  • Loading branch information
staticdev committed Dec 4, 2023
2 parents 0118e90 + abfb91f commit 96e2998
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions tests/unit/test_hooks.py
Expand Up @@ -11,7 +11,7 @@ def test_git_hook(src_dir):
# Ensure correct subprocess command is called
with patch("subprocess.run", MagicMock()) as run_mock:
hooks.git_hook()
assert run_mock.called_once()
run_mock.assert_called_once()
assert run_mock.call_args[0][0] == [
"git",
"diff-index",
Expand All @@ -21,8 +21,9 @@ def test_git_hook(src_dir):
"HEAD",
]

with patch("subprocess.run", MagicMock()) as run_mock:
hooks.git_hook(lazy=True)
assert run_mock.called_once()
run_mock.assert_called_once()
assert run_mock.call_args[0][0] == [
"git",
"diff-index",
Expand Down

0 comments on commit 96e2998

Please sign in to comment.