File pytest74.patch of Package python-sybil

From df0d221c1d9da1454a5ef7fd72675d8d43b96eb0 Mon Sep 17 00:00:00 2001
From: Chris Withers <chris@simplistix.co.uk>
Date: Tue, 4 Jul 2023 18:54:22 +0100
Subject: [PATCH] Deal with more pytest internals changing

---
 .circleci/config.yml        |  3 ++-
 sybil/integration/pytest.py | 22 +++++++++++++++++-----
 2 files changed, 19 insertions(+), 6 deletions(-)

diff --git a/sybil/integration/pytest.py b/sybil/integration/pytest.py
index b32062d..8529771 100644
--- a/sybil/integration/pytest.py
+++ b/sybil/integration/pytest.py
@@ -78,11 +78,23 @@ def setup(self):
     def runtest(self):
         self.example.evaluate()
 
-    def _prunetraceback(self, excinfo):
-        tb = excinfo.traceback.cut(path=example_module_path)
-        tb = tb[1]
-        if getattr(tb, '_rawentry', None) is not None:
-            excinfo.traceback = Traceback(tb._rawentry, excinfo)
+    if PYTEST_VERSION >= (7, 4, 0):
+
+        def _traceback_filter(self, excinfo: ExceptionInfo[BaseException]) -> Traceback:
+            traceback = excinfo.traceback
+            tb = traceback.cut(path=example_module_path)
+            tb = tb[1]
+            if getattr(tb, '_rawentry', None) is not None:
+                traceback = Traceback(tb._rawentry)
+            return traceback
+
+    else:
+
+        def _prunetraceback(self, excinfo):
+            tb = excinfo.traceback.cut(path=example_module_path)
+            tb = tb[1]
+            if getattr(tb, '_rawentry', None) is not None:
+                excinfo.traceback = Traceback(tb._rawentry, excinfo)
 
     def repr_failure(
         self,
openSUSE Build Service is sponsored by