{
  "id": "python/pytest-subtests-unittest-count",
  "signature": "FAILED tests/test_math.py::TestMath::test_add - AssertionError: 1 != 2\nSubTest failed: \n  test_add (test_math.TestMath.test_add) (i=1)\nAssertionError: 1 != 2",
  "signature_zh": "FAILED tests/test_math.py::TestMath::test_add - AssertionError: 1 != 2\n子测试失败: \n  test_add (test_math.TestMath.test_add) (i=1)\nAssertionError: 1 != 2",
  "regex": "FAILED\\ tests/test_math\\.py::TestMath::test_add\\ \\-\\ AssertionError:\\ 1\\ !=\\ 2\\\nSubTest\\ failed:\\ \\\n\\ \\ test_add\\ \\(test_math\\.TestMath\\.test_add\\)\\ \\(i=1\\)\\\nAssertionError:\\ 1\\ !=\\ 2",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "unittest's subTest failures are reported by pytest but not always counted as separate failures in JUnit XML or exit codes when using older pytest versions or the pytest-subtests plugin without proper config.",
  "root_cause_type": "generic",
  "root_cause_zh": "unittest 的 subTest 失败会被 pytest 报告，但在使用较旧 pytest 版本或未正确配置 pytest-subtests 插件时，不总是作为独立失败计入 JUnit XML 或退出码。",
  "versions": [
    {
      "version": "7.4",
      "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": "Changes test IDs and reporting; may break CI dashboards that key on names.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Reimplements subTest poorly; loses per-case reporting.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Install pytest-subtests:\n  pip install pytest-subtests\nSubtest failures then appear as separate test outcomes in reports.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Upgrade pytest to >= 7.4 which improved subTest reporting and exit codes.",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}