{
  "id": "python/pytest-flaky-test-random-failure",
  "signature": "AssertionError: assert 'foo' == 'bar'  # intermittent",
  "signature_zh": "AssertionError: assert 'foo' == 'bar'  # 间歇性",
  "regex": "AssertionError:\\ assert\\ 'foo'\\ ==\\ 'bar'\\ \\ \\#\\ intermittent",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Test depends on ordering or shared mutable state; when run in a different order (e.g., with `-p no:randomly` or xdist), it fails.",
  "root_cause_type": "generic",
  "root_cause_zh": "测试依赖于顺序或共享可变状态；当以不同顺序运行（例如使用 `-p no:randomly` 或 xdist）时，它会失败。",
  "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": "Masks the underlying bug and increases test time; failures may still occur.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Hides the order dependency but does not fix it; CI may use a different order.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "@pytest.fixture\ndef state():\n    return {}\n\ndef test_a(state):\n    state['x'] = 1",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "pytest -p randomly --randomly-seed=12345",
      "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-12-03",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}