b47d939
From 398f003660dda242b97217390718a2a90c3d7a88 Mon Sep 17 00:00:00 2001
b47d939
From: Stanislav Levin <slev@altlinux.org>
b47d939
Date: Tue, 13 Feb 2024 12:44:53 +0300
b47d939
Subject: [PATCH] Sync expected test_xfail's xpassed summary to Pytest 8
b47d939
b47d939
With Pytest 8:
b47d939
https://docs.pytest.org/en/stable/changelog.html#pytest-8-0-0rc2-2024-01-17
b47d939
b47d939
> For xpasses, add - in summary between test name and reason, to match how xfail is displayed.
b47d939
b47d939
Fixes: https://github.com/pytest-dev/pytest-forked/issues/89
b47d939
Signed-off-by: Stanislav Levin <slev@altlinux.org>
b47d939
---
b47d939
 testing/test_xfail_behavior.py | 11 +++++------
b47d939
 1 file changed, 5 insertions(+), 6 deletions(-)
b47d939
b47d939
diff --git a/testing/test_xfail_behavior.py b/testing/test_xfail_behavior.py
b47d939
index 15edd93..d4e5ee7 100644
b47d939
--- a/testing/test_xfail_behavior.py
b47d939
+++ b/testing/test_xfail_behavior.py
b47d939
@@ -7,6 +7,7 @@
b47d939
 IS_PYTEST4_PLUS = int(pytest.__version__[0]) >= 4  # noqa: WPS609
b47d939
 FAILED_WORD = "FAILED" if IS_PYTEST4_PLUS else "FAIL"
b47d939
 PYTEST_GTE_7_2 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (7, 2)  # type: ignore[attr-defined]
b47d939
+PYTEST_GTE_8_0 = hasattr(pytest, "version_tuple") and pytest.version_tuple >= (8, 0)  # type: ignore[attr-defined]
b47d939
 
b47d939
 pytestmark = pytest.mark.skipif(  # pylint: disable=invalid-name
b47d939
     not hasattr(os, "fork"),  # noqa: WPS421
b47d939
@@ -60,12 +61,10 @@ def test_xfail(is_crashing, is_strict, testdir):
b47d939
     if expected_lowercase == "xpassed":
b47d939
         # XPASS wouldn't have the crash message from
b47d939
         # pytest-forked because the crash doesn't happen
b47d939
-        short_test_summary = " ".join(
b47d939
-            (
b47d939
-                short_test_summary,
b47d939
-                "The process gets terminated",
b47d939
-            )
b47d939
-        )
b47d939
+        if PYTEST_GTE_8_0:
b47d939
+            short_test_summary += " -"
b47d939
+        short_test_summary += " The process gets terminated"
b47d939
+
b47d939
     reason_string = (
b47d939
         f"reason: The process gets terminated; "
b47d939
         f"pytest-forked reason: "