File support-python-312.patch of Package python-pytest-examples

From 35f93d668c8a4a337d1c9d477fa5732fa439b1b3 Mon Sep 17 00:00:00 2001
From: Alex Hall <alex.mojaki@gmail.com>
Date: Wed, 27 Sep 2023 17:47:51 +0200
Subject: [PATCH 1/2] Fix deprecation warnings in Python 3.12

---
 .github/workflows/ci.yml     |  2 +-
 pytest_examples/traceback.py | 21 ++++++++++++++++++++-
 requirements/testing.txt     |  6 ++----
 3 files changed, 23 insertions(+), 6 deletions(-)

diff --git a/pytest_examples/traceback.py b/pytest_examples/traceback.py
index 94ede45..41880fe 100644
--- a/pytest_examples/traceback.py
+++ b/pytest_examples/traceback.py
@@ -62,7 +62,26 @@ def create_custom_frame(frame: FrameType, example: CodeExample) -> FrameType:
     ctypes.pythonapi.PyThreadState_Get.restype = P_MEM_TYPE
 
     f_code = frame.f_code
-    if sys.version_info >= (3, 11):
+    if sys.version_info >= (3, 12):
+        code = CodeType(
+            f_code.co_argcount,
+            f_code.co_posonlyargcount,
+            f_code.co_kwonlyargcount,
+            f_code.co_nlocals,
+            f_code.co_stacksize,
+            f_code.co_flags,
+            f_code.co_code,
+            f_code.co_consts,
+            f_code.co_names,
+            f_code.co_varnames,
+            str(example.path),
+            f_code.co_name,
+            f_code.co_qualname,
+            f_code.co_firstlineno + example.start_line,
+            f_code.co_linetable,
+            f_code.co_exceptiontable,
+        )
+    elif sys.version_info >= (3, 11):
         code = CodeType(
             f_code.co_argcount,
             f_code.co_posonlyargcount,
diff --git a/requirements/testing.txt b/requirements/testing.txt
index 805175d..4b42722 100644
--- a/requirements/testing.txt
+++ b/requirements/testing.txt
@@ -2,10 +2,8 @@
 # This file is autogenerated by pip-compile with Python 3.10
 # by the following command:
 #
-#    pip-compile --output-file=requirements/testing.txt --resolver=backtracking requirements/testing.in
+#    pip-compile --output-file=requirements/testing.txt requirements/testing.in
 #
-attrs==22.2.0
-    # via pytest
 coverage==7.2.2
     # via -r requirements/testing.in
 exceptiongroup==1.1.1
@@ -22,7 +20,7 @@ pluggy==1.0.0
     # via pytest
 pygments==2.14.0
     # via rich
-pytest==7.2.2
+pytest==7.4.2
     # via pytest-pretty
 pytest-pretty==1.1.1
     # via -r requirements/testing.in
openSUSE Build Service is sponsored by