{
  "id": "python/pytest-fixture-return-none",
  "signature": "Fixture 'data' called directly. Fixtures are not meant to be called directly, but are provided automatically by pytest.",
  "signature_zh": "夹具 'data' 被直接调用。夹具不是用来直接调用的，而是由 pytest 自动提供的。",
  "regex": "Fixture\\ 'data'\\ called\\ directly\\.\\ Fixtures\\ are\\ not\\ meant\\ to\\ be\\ called\\ directly,\\ but\\ are\\ provided\\ automatically\\ by\\ pytest\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A test or fixture tries to call a fixture function directly (e.g., data()) instead of using it as a parameter, causing pytest to raise an error because fixtures are not regular functions.",
  "root_cause_type": "generic",
  "root_cause_zh": "测试或夹具尝试直接调用夹具函数（如 data()），而不是将其作为参数使用，导致 pytest 引发错误，因为夹具不是常规函数。",
  "versions": [
    {
      "version": "3.10",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Adding a return value to the fixture does not fix the issue because the fixture is still being called incorrectly.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Converting the fixture to a regular function may work but loses the benefits of fixture scoping and dependency injection.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Use the fixture as a parameter in the test function: def test_foo(data): instead of calling data().",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "If you need to call a fixture programmatically, use the request fixture: request.getfixturevalue('data')",
      "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.86,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-04-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}