Files
HSAP/algorithms/dms_yolo/code.embedded.bak/tests/conftest.py
Chengfang Lu e72bc061c5 feat: HSAP platform v2 — modular navigation, quality review, audit log, world model simulation
Major changes:
- New frontend (platform/web/): Vite + React 18 + TypeScript + Tailwind
- 4-module navigation: 数据送标 / 模型管理 / 车队管理 / 系统管理
- Data catalog with charts (DMS/ADAS/Lane 3-tab view)
- Quality review workflow (标注质检): Good/Fine/Bad scoring with auto-advance
- Audit enhancements: batch operations, rejection categories, Feishu notifications
- Operation audit log (操作日志)
- World model simulation studio (仿真工坊)
- Dataset version management with snapshots and diff
- ADAS 7-class dataset integration (138K images organized + compressed)
- User management with Feishu integration and pagination
- CRUD/search/filter on all pages, card layout redesign
- PIL-optimized image overlay rendering
- Auto-snapshot on build, in_review workflow stage
- Removed embedded algorithm code (now in workspace)
2026-06-03 11:40:21 +08:00

60 lines
2.3 KiB
Python

# Ultralytics 🚀 AGPL-3.0 License - https://ultralytics.com/license
import shutil
from pathlib import Path
def pytest_addoption(parser):
"""Add custom command-line options to pytest."""
parser.addoption("--slow", action="store_true", default=False, help="Run slow tests")
def pytest_collection_modifyitems(config, items):
"""Modify the list of test items to exclude tests marked as slow if the --slow option is not specified.
Args:
config: The pytest configuration object that provides access to command-line options.
items (list): The list of collected pytest item objects to be modified based on the presence of --slow option.
"""
if not config.getoption("--slow"):
# Remove the item entirely from the list of test items if it's marked as 'slow'
items[:] = [item for item in items if "slow" not in item.keywords]
def pytest_sessionstart(session):
"""Initialize session configurations for pytest.
This function is automatically called by pytest after the 'Session' object has been created but before performing
test collection. It sets the initial seeds for the test session.
Args:
session: The pytest session object.
"""
from ultralytics.utils.torch_utils import init_seeds
init_seeds()
def pytest_terminal_summary(terminalreporter, exitstatus, config):
"""Cleanup operations after pytest session.
This function is automatically called by pytest at the end of the entire test session. It removes certain files and
directories used during testing.
Args:
terminalreporter: The terminal reporter object used for terminal output.
exitstatus (int): The exit status of the test run.
config: The pytest config object.
"""
from ultralytics.utils import WEIGHTS_DIR
# Remove files
models = [path for x in {"*.onnx", "*.torchscript"} for path in WEIGHTS_DIR.rglob(x)]
for file in ["decelera_portrait_min.mov", "bus.jpg", "yolo26n.onnx", "yolo26n.torchscript", *models]:
Path(file).unlink(missing_ok=True)
# Remove directories
models = [path for x in {"*.mlpackage", "*_openvino_model"} for path in WEIGHTS_DIR.rglob(x)]
for directory in [WEIGHTS_DIR / "path with spaces", *models]:
shutil.rmtree(directory, ignore_errors=True)