[tool:pytest] # pytest配置文件 # 测试发现 testpaths = test python_files = test_*.py python_classes = Test* python_functions = test_* # 输出配置 addopts = -v --tb=short --strict-markers --strict-config --color=yes --durations=10 --cov=server --cov=client --cov=shared --cov-report=html:test/reports/coverage --cov-report=term-missing --cov-report=xml:test/reports/coverage.xml --html=test/reports/report.html --self-contained-html --junitxml=test/reports/junit.xml # 标记定义 markers = unit: 单元测试 integration: 集成测试 functional: 功能测试 performance: 性能测试 slow: 慢速测试(运行时间较长) network: 需要网络连接的测试 ai: AI相关测试 database: 数据库相关测试 file_transfer: 文件传输相关测试 # 过滤警告 filterwarnings = ignore::DeprecationWarning ignore::PendingDeprecationWarning ignore::UserWarning:textual.* # 最小版本要求 minversion = 6.0 # 测试超时(秒) timeout = 300 # 并行测试配置 # 使用 pytest-xdist 插件时的配置 # addopts = -n auto # 日志配置 log_cli = true log_cli_level = INFO log_cli_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s log_cli_date_format = %Y-%m-%d %H:%M:%S log_file = test/logs/pytest.log log_file_level = DEBUG log_file_format = %(asctime)s [%(levelname)8s] %(name)s: %(message)s (%(filename)s:%(lineno)d) log_file_date_format = %Y-%m-%d %H:%M:%S # 自动使用的插件 required_plugins = pytest-cov pytest-html pytest-mock # 测试收集配置 collect_ignore = archive docs logs reports # 缓存配置 cache_dir = test/.pytest_cache