- Add patch suppot-python-312.patch:

* Support code changes in Python 3.12+.

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python:pytest/python-pytest-examples?expand=0&rev=6
This commit is contained in:
2024-01-24 06:45:49 +00:00
committed by Git OBS Bridge
parent 8fd31d5232
commit 3d08560b5d
3 changed files with 80 additions and 4 deletions

View File

@@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Jan 24 06:44:56 UTC 2024 - Steve Kowalik <steven.kowalik@suse.com>
- Add patch suppot-python-312.patch:
* Support code changes in Python 3.12+.
-------------------------------------------------------------------
Thu Oct 19 16:35:18 UTC 2023 - Ondřej Súkup <mimi.vx@gmail.com>

View File

@@ -1,7 +1,7 @@
#
# spec file for package python-pytest-examples
#
# Copyright (c) 2023 SUSE LLC
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@@ -26,6 +26,8 @@ URL: https://github.com/pydantic/pytest-examples
Source: https://github.com/pydantic/pytest-examples/archive/refs/tags/v%{version}.tar.gz#/pytest-examples-%{version}.tar.gz
# PATCH-FIX-UPSTREAM test-ruff-0.1.0.patch - fix tests for ruff-0.1.0
Patch0: test-ruff-0.1.0.patch
# PATCH-FIX-UPSTREAM gh#pydantic/pytest-examples#22
Patch1: suppot-python-312.patch
BuildRequires: %{python_module black}
BuildRequires: %{python_module hatchling}
BuildRequires: %{python_module pip}
@@ -59,11 +61,11 @@ It can also update code examples in place to format them and insert or update pr
%pyproject_install
%python_expand %fdupes %{buildroot}%{$python_sitelib}
%check
%pytest
%files %{python_files}
%{python_sitelib}/pytest_examples
%{python_sitelib}/pytest_examples-%{version}.dist-info
%check
%pytest
%changelog

68
suppot-python-312.patch Normal file
View File

@@ -0,0 +1,68 @@
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