From 3d08560b5d0aa020436d8c927a2128dafd008be1af0656145b567b3c0580572b Mon Sep 17 00:00:00 2001 From: Steve Kowalik Date: Wed, 24 Jan 2024 06:45:49 +0000 Subject: [PATCH] - 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 --- python-pytest-examples.changes | 6 +++ python-pytest-examples.spec | 10 +++-- suppot-python-312.patch | 68 ++++++++++++++++++++++++++++++++++ 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 suppot-python-312.patch diff --git a/python-pytest-examples.changes b/python-pytest-examples.changes index 3019dab..857127a 100644 --- a/python-pytest-examples.changes +++ b/python-pytest-examples.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Wed Jan 24 06:44:56 UTC 2024 - Steve Kowalik + +- 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 diff --git a/python-pytest-examples.spec b/python-pytest-examples.spec index c995768..cb5c857 100644 --- a/python-pytest-examples.spec +++ b/python-pytest-examples.spec @@ -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 diff --git a/suppot-python-312.patch b/suppot-python-312.patch new file mode 100644 index 0000000..9df43fe --- /dev/null +++ b/suppot-python-312.patch @@ -0,0 +1,68 @@ +From 35f93d668c8a4a337d1c9d477fa5732fa439b1b3 Mon Sep 17 00:00:00 2001 +From: Alex Hall +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