{
  "id": "python/pytest-conftest-not-found",
  "signature": "pytest.PytestConfigWarning: conftest.py not found in 'tests/'",
  "signature_zh": "pytest.PytestConfigWarning: 在 'tests/' 中未找到 conftest.py",
  "regex": "pytest\\.PytestConfigWarning:\\ conftest\\.py\\ not\\ found\\ in\\ 'tests/'",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "pytest expects a conftest.py file in the test directory for shared fixtures and hooks, but it is missing, which may cause fixture resolution failures if tests rely on conftest-defined fixtures.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest期望在测试目录中存在conftest.py文件以共享fixture和钩子，但该文件缺失，如果测试依赖于conftest定义的fixture，可能会导致fixture解析失败。",
  "versions": [
    {
      "version": "7.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "8.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Creating an empty conftest.py file without any content",
      "why_fails": "This suppresses the warning but does not provide the necessary fixtures, causing test failures later.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Moving all fixtures to each individual test file",
      "why_fails": "This duplicates code and reduces maintainability, but may resolve the immediate warning.",
      "fail_rate": 0.3,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create a proper conftest.py file with the necessary fixtures and hooks",
      "success_rate": 0.95,
      "how": "In the tests/ directory, create conftest.py:\nimport pytest\n\n@pytest.fixture\ndef shared_fixture():\n    return 'data'\nThen tests can use 'shared_fixture' without importing.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Specify a custom conftest path using pytest's --confcutdir option",
      "success_rate": 0.7,
      "how": "pytest --confcutdir=tests/ tests/\nThis tells pytest to look for conftest only in the tests/ directory.",
      "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.81,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-09-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}