[P1] 合并 48 对重复测试文件(tests/unit/ 与 tests/unit/domain/) #1832

Closed
opened 2026-09-10 12:07:09 +08:00 by xiaoxia · 1 comment
Owner

背景

Staging 代码审计发现 tests/unit/ 顶层和 tests/unit/domain/ 下存在 48 对同名测试文件,内容不同但覆盖相同模块,总计约 35,000 行冗余代码。

典型重复文件对(差异较大者)

文件 tests/unit/ 行数 tests/unit/domain/ 行数 diff 行数
test_video_filter_builder.py 1,120 715 1,732
test_plan_generator_utils.py 779 537 1,102
test_clip_operations.py 649 518 1,092
test_config_schemas.py 510 825 1,073
test_url_security.py 816 567 1,338
test_trim_config.py 639 612 1,033
test_template_clip_converter.py 778 496 1,003
test_intro_outro_config.py 537 593 973

处理方案

  1. 对每对同名文件,对比内容,保留测试覆盖更完整的版本
  2. 将另一个版本的独有测试用例合并到保留版本中
  3. 删除冗余副本
  4. pytest.ini 已设置 --import-mode=importlib 避免同名冲突,合并后可简化

验收标准

  • 48 对测试文件合并为单份
  • 所有测试用例保留无丢失
  • pytest 全部通过
  • CI 全绿
## 背景 Staging 代码审计发现 tests/unit/ 顶层和 tests/unit/domain/ 下存在 48 对同名测试文件,内容不同但覆盖相同模块,总计约 35,000 行冗余代码。 ## 典型重复文件对(差异较大者) | 文件 | tests/unit/ 行数 | tests/unit/domain/ 行数 | diff 行数 | |------|-----------------|----------------------|----------| | test_video_filter_builder.py | 1,120 | 715 | 1,732 | | test_plan_generator_utils.py | 779 | 537 | 1,102 | | test_clip_operations.py | 649 | 518 | 1,092 | | test_config_schemas.py | 510 | 825 | 1,073 | | test_url_security.py | 816 | 567 | 1,338 | | test_trim_config.py | 639 | 612 | 1,033 | | test_template_clip_converter.py | 778 | 496 | 1,003 | | test_intro_outro_config.py | 537 | 593 | 973 | ## 处理方案 1. 对每对同名文件,对比内容,保留测试覆盖更完整的版本 2. 将另一个版本的独有测试用例合并到保留版本中 3. 删除冗余副本 4. pytest.ini 已设置 --import-mode=importlib 避免同名冲突,合并后可简化 ## 验收标准 - 48 对测试文件合并为单份 - 所有测试用例保留无丢失 - pytest 全部通过 - CI 全绿
xiaoxia added the bugbackendcleanup labels 2026-09-10 12:07:09 +08:00
Author
Owner

本轮未推进,关闭。48 对重复测试文件合并后续单独排期。

本轮未推进,关闭。48 对重复测试文件合并后续单独排期。
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: xiaoxia/xiaoxia-saas#1832