1717 CommitTypeValidator ,
1818)
1919from commit_check .rule_builder import ValidationRule
20+ import pytest
2021
2122
2223class TestValidationResult :
24+ @pytest .mark .benchmark
2325 def test_validation_result_values (self ):
2426 """Test ValidationResult enum values."""
2527 assert ValidationResult .PASS == 0
2628 assert ValidationResult .FAIL == 1
2729
2830
2931class TestValidationContext :
32+ @pytest .mark .benchmark
3033 def test_validation_context_creation (self ):
3134 """Test ValidationContext creation."""
3235 context = ValidationContext ()
@@ -41,6 +44,7 @@ def test_validation_context_creation(self):
4144
4245
4346class TestCommitMessageValidator :
47+ @pytest .mark .benchmark
4448 def test_commit_message_validator_creation (self ):
4549 """Test CommitMessageValidator creation."""
4650 rule = ValidationRule (
@@ -53,6 +57,7 @@ def test_commit_message_validator_creation(self):
5357 assert validator .rule == rule
5458
5559 @patch ("commit_check.engine.has_commits" )
60+ @pytest .mark .benchmark
5661 def test_commit_message_validator_with_stdin (self , mock_has_commits ):
5762 """Test CommitMessageValidator with stdin text."""
5863 mock_has_commits .return_value = True
@@ -71,6 +76,7 @@ def test_commit_message_validator_with_stdin(self, mock_has_commits):
7176
7277 @patch ("commit_check.engine.get_commit_info" )
7378 @patch ("commit_check.engine.has_commits" )
79+ @pytest .mark .benchmark
7480 def test_commit_message_validator_failure (
7581 self , mock_has_commits , mock_get_commit_info
7682 ):
@@ -92,6 +98,7 @@ def test_commit_message_validator_failure(
9298 mock_print .assert_called_once ()
9399
94100 @patch ("commit_check.engine.has_commits" )
101+ @pytest .mark .benchmark
95102 def test_commit_message_validator_skip_validation (self , mock_has_commits ):
96103 """Test CommitMessageValidator skips when no commits and no stdin."""
97104 mock_has_commits .return_value = False
@@ -110,6 +117,7 @@ def test_commit_message_validator_skip_validation(self, mock_has_commits):
110117
111118
112119class TestSubjectCapitalizationValidator :
120+ @pytest .mark .benchmark
113121 def test_subject_capitalization_pass (self ):
114122 """Test SubjectCapitalizationValidator pass case."""
115123 rule = ValidationRule (
@@ -125,6 +133,7 @@ def test_subject_capitalization_pass(self):
125133 result = validator .validate (context )
126134 assert result == ValidationResult .PASS
127135
136+ @pytest .mark .benchmark
128137 def test_subject_capitalization_fail (self ):
129138 """Test SubjectCapitalizationValidator fail case."""
130139 rule = ValidationRule (
@@ -144,6 +153,7 @@ def test_subject_capitalization_fail(self):
144153
145154
146155class TestSubjectImperativeValidator :
156+ @pytest .mark .benchmark
147157 def test_subject_imperative_pass (self ):
148158 """Test SubjectImperativeValidator pass case."""
149159 rule = ValidationRule (
@@ -159,6 +169,7 @@ def test_subject_imperative_pass(self):
159169 result = validator .validate (context )
160170 assert result == ValidationResult .PASS
161171
172+ @pytest .mark .benchmark
162173 def test_subject_imperative_fail (self ):
163174 """Test SubjectImperativeValidator fail case."""
164175 rule = ValidationRule (
@@ -178,6 +189,7 @@ def test_subject_imperative_fail(self):
178189
179190
180191class TestSubjectLengthValidator :
192+ @pytest .mark .benchmark
181193 def test_subject_length_pass (self ):
182194 """Test SubjectLengthValidator pass case."""
183195 rule = ValidationRule (
@@ -193,6 +205,7 @@ def test_subject_length_pass(self):
193205 result = validator .validate (context )
194206 assert result == ValidationResult .PASS
195207
208+ @pytest .mark .benchmark
196209 def test_subject_length_fail (self ):
197210 """Test SubjectLengthValidator fail case."""
198211 rule = ValidationRule (
@@ -212,6 +225,7 @@ def test_subject_length_fail(self):
212225
213226
214227class TestValidationEngine :
228+ @pytest .mark .benchmark
215229 def test_validation_engine_creation (self ):
216230 """Test ValidationEngine creation."""
217231 rules = [
@@ -225,6 +239,7 @@ def test_validation_engine_creation(self):
225239 engine = ValidationEngine (rules )
226240 assert engine .rules == rules
227241
242+ @pytest .mark .benchmark
228243 def test_validation_engine_validator_map (self ):
229244 """Test ValidationEngine VALIDATOR_MAP contains expected mappings."""
230245 engine = ValidationEngine ([])
@@ -252,6 +267,7 @@ def test_validation_engine_validator_map(self):
252267 for check , validator_class in expected_mappings .items ():
253268 assert engine .VALIDATOR_MAP [check ] == validator_class
254269
270+ @pytest .mark .benchmark
255271 def test_validation_engine_validate_all_pass (self ):
256272 """Test ValidationEngine validate_all with all passing rules."""
257273 rules = [
@@ -269,6 +285,7 @@ def test_validation_engine_validate_all_pass(self):
269285 result = engine .validate_all (context )
270286 assert result == ValidationResult .PASS
271287
288+ @pytest .mark .benchmark
272289 def test_validation_engine_validate_all_fail (self ):
273290 """Test ValidationEngine validate_all with failing rule."""
274291 rules = [
@@ -286,6 +303,7 @@ def test_validation_engine_validate_all_fail(self):
286303 result = engine .validate_all (context )
287304 assert result == ValidationResult .FAIL
288305
306+ @pytest .mark .benchmark
289307 def test_validation_engine_unknown_validator (self ):
290308 """Test ValidationEngine with unknown validator type."""
291309 rules = [
0 commit comments