test-fixture-generator

👤 shenghoo123-png 📦 v1.0.0 ⭐ 4.3 ⬇️ 674 下载
💻 开发编程 免费

📖 技能介绍

test-fixture-generator

名称

7w4.net收录了海量优质技能插件。

test-fixture-generator

描述

自动生成pytest fixtures的工具,支持常见测试场景(数据库、API mock、文件处理等)

触发词

fixture, pytest fixture, conftest, 测试夹具

指令

生成pytest fixtures代码

使用方式

# 生成数据库fixture
python -m test_fixture_generator generate --type db --db-type mysql

# 生成API mock fixture
python -m test_fixture_generator generate --type api --framework requests

# 生成文件处理fixture
python -m test_fixture_generator generate --type file --format json

# 生成conftest.py
python -m test_fixture_generator init

# 交互式生成
python -m test_fixture_generator interactive

参数说明

  • --type: fixture类型 (db|api|file|random)
  • --db-type: 数据库类型 (mysql|postgres|sqlite)
  • --framework: mock框架 (requests|httpx|boto3)
  • --format: 文件格式 (json|yaml|csv|toml)
  • --output: 输出文件路径

输出

生成符合pytest规范的fixture代码,自动处理setup/teardown

🤖 AI 评测

这个工具质量不错,能自动生成各种测试用的代码模板,省去手动编写的麻烦。功能丰富,支持多种数据库和API mock,文档清晰易读,代码结构整齐。不足之处是配置选项较多,新手可能需要花点时间熟悉;部分模板的设置是固定的,不太灵活。总体来说是个好用的辅助工具,适合经常写测试代码的开发者。

📊 多维度评分

适应性4.4
规范性4.1
有效性4.6
可靠性4
可信度4.8

📁 包含文件 (7 个)

📄 README.md 4.8 KB
📄 SKILL.md 1 KB
📄 __init__.py 279 B
📄 _meta.json 141 B
📄 cli.py 8.8 KB
📄 generator.py 16.7 KB
📄 tests/test_generator.py 10.3 KB