{
  "id": "python/pytest-fixture-indirect-param-missing",
  "signature": "TypeError: test_func() missing 1 required positional argument: 'value'",
  "signature_zh": "TypeError: test_func() 缺少 1 个必需的位置参数: 'value'",
  "regex": "TypeError:\\ test_func\\(\\)\\ missing\\ 1\\ required\\ positional\\ argument:\\ 'value'",
  "domain": "python",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "pytest.mark.parametrize(..., indirect=True) was used, but the named fixture does not actually accept a 'request' argument to read request.param, so the fixture returns nothing and the test sees a missing argument.",
  "root_cause_type": "generic",
  "root_cause_zh": "使用了 pytest.mark.parametrize(..., indirect=True)，但指定的 fixture 没有接受 'request' 参数来读取 request.param，因此 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": "Changes the fixture into a direct parameter, so the fixture logic (setup, teardown) never runs.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Hides the real problem; the fixture still does not receive the parametrized value.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "@pytest.fixture\ndef value(request):\n    return request.param * 2\n\n@pytest.mark.parametrize('value', [1, 2, 3], indirect=True)\ndef test_func(value):\n    assert value in (2, 4, 6)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "@pytest.fixture\ndef make_value():\n    def _make(n):\n        return n * 2\n    return _make\n\n@pytest.mark.parametrize('n', [1, 2, 3])\ndef test_func(make_value, n):\n    assert make_value(n) in (2, 4, 6)",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-21",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}