{
  "id": "python/pytest-freezegun-timezone",
  "signature": "AssertionError: assert datetime.date(2025, 1, 1) == datetime.date(2024, 12, 31)\n# only fails in CI in UTC",
  "signature_zh": "AssertionError: assert datetime.date(2025, 1, 1) == datetime.date(2024, 12, 31)\n# 仅在 UTC 的 CI 中失败",
  "regex": "AssertionError:\\ assert\\ datetime\\.date\\(2025,\\ 1,\\ 1\\)\\ ==\\ datetime\\.date\\(2024,\\ 12,\\ 31\\)\\\n\\#\\ only\\ fails\\ in\\ CI\\ in\\ UTC",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "freezegun freezes UTC time by default; tests that assert on local time or use timezone-aware code fail when developer machine TZ differs from CI TZ.",
  "root_cause_type": "generic",
  "root_cause_zh": "freezegun 默认冻结 UTC 时间；断言本地时间或使用时区感知代码的测试在开发者机器 TZ 与 CI TZ 不同时失败。",
  "versions": [
    {
      "version": "1.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Makes CI match freezegun but local runs diverge; the underlying timezone-aware bug remains.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "freezegun interprets the string as UTC; local-time assertions still fail.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Tests become flaky around midnight and month boundaries; loses determinism.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "from freezegun import freeze_time\n\n@freeze_time('2025-01-01 00:00:00', tz_offset=0)\ndef test_x():\n    ...\n\n# or use tz-aware datetimes in assertions",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "from datetime import datetime, timezone\n\nnow = datetime.now(timezone.utc)\n# assert against UTC-aware values in tests",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-09-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}