{
  "id": "python/pytest-flaky-test-rerun-failed",
  "signature": "Flaky test detected: test_foo failed 2 times, passed 1 time",
  "signature_zh": "检测到不稳定的测试: test_foo 失败 2 次，通过 1 次",
  "regex": "Flaky\\ test\\ detected:\\ test_foo\\ failed\\ 2\\ times,\\ passed\\ 1\\ time",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The test is flaky, meaning it sometimes passes and sometimes fails due to non-deterministic behavior, race conditions, or external dependencies.",
  "root_cause_type": "generic",
  "root_cause_zh": "测试不稳定，意味着由于非确定性行为、竞争条件或外部依赖，它有时通过有时失败。",
  "versions": [
    {
      "version": "2.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This masks the flakiness and can hide real bugs.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This stops the test from running and doesn't fix the underlying issue.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Look for: random data, time-dependent logic, network calls, shared state, order dependence. Use pytest -p no:randomly to disable random order.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "For random: random.seed(42)\nFor time: freeze_time or mock datetime.now()\nFor network: use responses or mock.",
      "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.8,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-08-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}