{
  "id": "python/pytest-parametrize-empty",
  "signature": "Skipped: got empty parameter set for (u)<function test_parse at 0x7f...>",
  "signature_zh": "已跳过: (u)<function test_parse at 0x7f...> 的参数集为空",
  "regex": "Skipped:\\ got\\ empty\\ parameter\\ set\\ for\\ \\(u\\)<function\\ test_parse\\ at\\ 0x7f\\.\\.\\.>",
  "domain": "python",
  "category": "data_error",
  "subcategory": null,
  "root_cause": "A `@pytest.mark.parametrize` decorator was given an empty list, so pytest skips the test. Often caused by a fixture or generator returning an empty collection.",
  "root_cause_type": "generic",
  "root_cause_zh": "`@pytest.mark.parametrize` 装饰器接收到空列表，pytest 因此跳过该测试。常见原因是 fixture 或生成器返回空集合。",
  "versions": [
    {
      "version": "7.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "IDs don't create test cases; the parameter list is still empty.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Makes the test always skipped, losing coverage silently.",
      "fail_rate": 0.65,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Ensure the parametrize list is non-empty:\nCASES = load_cases()\nassert CASES, 'no cases loaded'\n@pytest.mark.parametrize('u', CASES)\ndef test_parse(u): ...",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use `pytest_generate_tests` to dynamically parametrize with a guard:\ndef pytest_generate_tests(metafunc):\n    if 'u' in metafunc.fixturenames:\n        cases = load_cases() or [pytest.param(None, marks=pytest.mark.skip('no cases'))]\n        metafunc.parametrize('u', cases)",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}