{
  "id": "python/pytest-parametrize-marks-mismatch",
  "signature": "In test_math.py: @pytest.mark.parametrize argument names ['a', 'b'] do not match the test function signature ['x', 'y']",
  "signature_zh": "在 test_math.py 中：@pytest.mark.parametrize 参数名 ['a', 'b'] 与测试函数签名 ['x', 'y'] 不匹配",
  "regex": "In\\ test_math\\.py:\\ @pytest\\.mark\\.parametrize\\ argument\\ names\\ \\['a',\\ 'b'\\]\\ do\\ not\\ match\\ the\\ test\\ function\\ signature\\ \\['x',\\ 'y'\\]",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "The parametrize argnames string does not match the test function's parameter names. pytest requires exact names (order matters for tuple args).",
  "root_cause_type": "generic",
  "root_cause_zh": "parametrize 的 argnames 字符串与测试函数的参数名不匹配。pytest 要求名称完全一致（对元组参数而言顺序也重要）。",
  "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": "pytest inspects the signature and rejects **kwargs for parametrization; test still errors.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "pytest treats 'args' as a single parameter, breaking tuple unpacking.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.98,
      "how": "Match names exactly:\n  @pytest.mark.parametrize('x,y', [(1,2),(3,4)])\n  def test_add(x, y): ...\nOr use a list of names:\n  @pytest.mark.parametrize(['x','y'], [...])",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use pytest.param with ids for clarity:\n  @pytest.mark.parametrize('x,y', [pytest.param(1,2,id='small')])",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-09",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}