refactor(tests): 重构测试代码并优化ruff检查规则

1.  在pyproject.toml中为测试文件添加ARG001和ARG002规则忽略
2.  重构多个CLI测试文件,移除冗余的mock断言、导入顺序调整
3.  统一测试用例的帮助信息输出逻辑,移除SystemExit捕获,简化测试流程
4.  拆分合并冗余的测试类,按功能细化测试用例
5.  移除测试代码中多余的注释和pytest导入
This commit is contained in:
2026-06-22 12:18:10 +08:00
parent d4a1a5c2de
commit 413ab40044
13 changed files with 616 additions and 953 deletions
+2 -2
View File
@@ -2,7 +2,7 @@
from __future__ import annotations
from unittest.mock import patch, MagicMock
from unittest.mock import MagicMock, patch
import pytest
@@ -103,4 +103,4 @@ class TestMain:
"""main() should create a CliRunner and call run_cli()."""
with patch.object(px.CliRunner, "run_cli") as mock_run_cli:
bumpversion.main()
assert mock_run_cli.called
assert mock_run_cli.called