文件最后提交记录最后更新时间
[bugfix]解决测试用例导包失败的问题 Co-authored-by: mazhixin00_00<mazhixin7@huawei.com> # message auto-generated for no-merge-commit merge: !199 merge init into dev [bugfix]解决测试用例导包失败的问题 Created-by: mazhixin00_00 Commit-by: mazhixin00_00 Merged-by: ascend-robot Description: <!-- PR描述模板更新日期:20251224 --> # Which issue(s) this PR fixes or accomplishes 有些环境,跑测试用例导包失败的问题 ![image.png](https://raw.gitcode.com/user-images/assets/8476587/b7f11b69-dc5f-43f3-839f-237a02aa5125/image.png 'image.png') # Test Plan 全量测试 # Test Report ![image.png](https://raw.gitcode.com/user-images/assets/8476587/a99938ad-ade8-42e7-bd08-4a5aa53c78b9/image.png 'image.png') See merge request: Ascend/MindIE-SD!1993 个月前
[Test]Standardize test infrastructure and fix lint compliance across test suite Co-authored-by: changetheway<guotaoyuan1@h-partners.com> # message auto-generated for no-merge-commit merge: !340 merge test_correct_0608 into dev [Test]Standardize test infrastructure and fix lint compliance across test suite Created-by: changetheway Commit-by: changetheway Merged-by: ascend-robot Description: # Which issue(s) this PR fixes or accomplishes > Fix part of #179 # Purpose 1. **统一测试基础设施** - 新增 tests/conftest.py,通过 pytest 内置机制配置 sys.pathASCEND_CUSTOM_OPP_PATH,替代各测试文件中散落的 sys.path.append / sys.path.insert - 同时将各测试文件中散落的 sys.path.append / sys.path.insertASCEND_CUSTOM_OPP_PATH添加到run.py中和run_test.sh中 - 新增 tests/utils/utils/torch_npu_mock.py,抽取统一的 mock_torch_npu() 工具函数,替代 tests/run.pytests/UT/run.py 中重复的内联 mock 逻辑 2. **修复 lint 合规性** - 移除所有测试文件中手动的 sys.path 操作(由 conftest.py 统一接管) - 添加 # pylint: disable=no-name-in-module 消除 NPU 模块 import 告警 - 统一 @unittest.skipIf 装饰器为多行格式 - 修复 import 排序、去除多余空行和尾逗号 3. **Pre-commit 配置对齐** - pre-commit/pyproject.toml:pylint disable 列表新增 duplicate-code ## 运行测试 ### 全量测试 ** 使用 run_test.sh(推荐,含覆盖率报告)** bash cd tests # 运行全量测试(含覆盖率报告) bash run_test.sh # 仅运行 CPU 兼容测试(无需 NPU 环境) bash run_test.sh --cpu_only # 仅运行 NPU 依赖测试 bash run_test.sh --npu_only ### 执行单个测试用例 方式一:使用 run_test.sh 指定文件 bash cd tests # 运行单个测试文件 bash run_test.sh quantization/test_layer.py # 运行多个测试文件 bash run_test.sh layers/test_embedding.py quantization/test_mode.py # CPU 模式下运行单个文件 bash run_test.sh --cpu_only quantization/test_mode.py 方式二:使用 pytest 方式 bash # pytest 方式(支持更多过滤选项) python -m pytest tests/quantization/test_layer.py -v # Test Plan 1. CPU 模式验证:MINDIE_TEST_MODE=CPU python -m pytest tests/ -k "not NPU",确认 mock 机制正确加载 2. Lint 检查:pre-commit run --all-files,确认新增 disable 项生效且无新增告警 3. 构建验证:在 CANN 8.x 环境执行 bash build/build_ops.sh,确认 customize_transformer 目录自动创建 4. NPU 模式回归:python tests/run.py,确认全量测试无回归 # Test Report 全量UT测试: ![image.png](https://raw.gitcode.com/user-images/assets/8476587/11746601-3e05-491c-8345-d2859037581b/image.png 'image.png') See merge request: Ascend/MindIE-SD!3405 天前