Skip to content

Commit f5c4b48

Browse files
committed
refactor(test): apply type-check-only imports
1 parent e6e7475 commit f5c4b48

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

tests/commands/test_check_command.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,9 @@ def test_check_command_with_amend_prefix_default(config, success_mock):
351351
success_mock.assert_called_once()
352352

353353

354-
def test_check_command_with_config_message_length_limit_and_cli_none(config, success_mock: MockType):
354+
def test_check_command_with_config_message_length_limit_and_cli_none(
355+
config, success_mock: MockType
356+
):
355357
message = "fix(scope): some commit message"
356358
config.settings["message_length_limit"] = len(message) + 1
357359
commands.Check(

tests/commands/test_commit_command.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,9 @@ def test_commit_message_length_uses_config_when_cli_unset(
377377
def test_commit_message_length_config_exceeded_when_cli_unset(
378378
config, prompt_mock_feat: MockType
379379
):
380-
config.settings["message_length_limit"] = _commit_first_line_len(prompt_mock_feat) - 1
380+
config.settings["message_length_limit"] = (
381+
_commit_first_line_len(prompt_mock_feat) - 1
382+
)
381383
with pytest.raises(CommitMessageLengthExceededError):
382384
commands.Commit(config, {"message_length_limit": None})()
383385

@@ -396,6 +398,8 @@ def test_commit_message_length_cli_overrides_stricter_config(
396398
def test_commit_message_length_cli_zero_disables_limit(
397399
config, success_mock: MockType, prompt_mock_feat: MockType
398400
):
399-
config.settings["message_length_limit"] = _commit_first_line_len(prompt_mock_feat) - 1
401+
config.settings["message_length_limit"] = (
402+
_commit_first_line_len(prompt_mock_feat) - 1
403+
)
400404
commands.Commit(config, {"message_length_limit": 0})()
401405
success_mock.assert_called_once()

tests/test_cli_config_integration.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
from __future__ import annotations
22

3-
from pathlib import Path
3+
from typing import TYPE_CHECKING
44

55
import pytest
66

77
from commitizen.exceptions import CommitMessageLengthExceededError, DryRunExit
8-
from tests.utils import UtilFixture
8+
9+
if TYPE_CHECKING:
10+
from pathlib import Path
11+
12+
from tests.utils import UtilFixture
913

1014

1115
def _write_pyproject_with_message_length_limit(
@@ -84,4 +88,3 @@ def test_cli_commit_cli_overrides_message_length_limit_from_pyproject(
8488

8589
with pytest.raises(DryRunExit):
8690
util.run_cli("commit", "--dry-run", "-l", "100")
87-

0 commit comments

Comments
 (0)