Skip to content

Commit 996e742

Browse files
authored
fix: update import to fix test (#291)
1 parent 27d9850 commit 996e742

File tree

5 files changed

+18
-2
lines changed

5 files changed

+18
-2
lines changed

docs/changelog.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:status: new
2+
13
Changelog
24
=========
35

docs/configuration.rst

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:status: new
2+
13
Configuration
24
=============
35

@@ -18,6 +20,7 @@ Example Configuration
1820
---------------------
1921

2022
.. code-block:: toml
23+
:class: copy
2124
2225
[commit]
2326
# https://www.conventionalcommits.org

docs/migration.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:status: new
2+
13
Migration Guide
24
===============
35

docs/what-is-new.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
:status: new
2+
13
What's New
24
==========
35

tests/engine_test.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,8 +94,15 @@ def test_commit_message_validator_with_file(self):
9494
finally:
9595
os.unlink(f.name)
9696

97-
def test_commit_message_validator_file_not_found(self):
97+
@patch("commit_check.engine.get_commit_info")
98+
def test_commit_message_validator_file_not_found(self, mock_get_commit_info):
9899
"""Test CommitMessageValidator with non-existent file."""
100+
# Mock git fallback to return a message that doesn't match regex
101+
mock_get_commit_info.side_effect = lambda format_str: {
102+
"s": "invalid commit message",
103+
"b": "",
104+
}[format_str]
105+
99106
rule = ValidationRule(check="message", regex=r"^feat:")
100107
validator = CommitMessageValidator(rule)
101108
context = ValidationContext(commit_file="/nonexistent/file")
@@ -123,7 +130,7 @@ def test_commit_message_validator_from_git(self, mock_get_commit_info):
123130

124131

125132
class TestBranchValidator:
126-
@patch("commit_check.util.get_branch_name")
133+
@patch("commit_check.engine.get_branch_name")
127134
def test_branch_validator_valid_branch(self, mock_get_branch_name):
128135
"""Test BranchValidator with valid branch name."""
129136
mock_get_branch_name.return_value = "feature/new-feature"

0 commit comments

Comments
 (0)