15
0

- add python312-syntax-warning.patch for python 3.12 support

OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-graphviz?expand=0&rev=31
This commit is contained in:
2023-12-06 22:23:18 +00:00
committed by Git OBS Bridge
parent 8e45185619
commit 78ade11a16
3 changed files with 37 additions and 1 deletions

View File

@@ -1,3 +1,8 @@
-------------------------------------------------------------------
Wed Dec 6 22:22:48 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add python312-syntax-warning.patch for python 3.12 support
-------------------------------------------------------------------
Fri Apr 21 12:25:49 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@@ -25,6 +25,7 @@ License: MIT
Group: Development/Languages/Python
URL: https://github.com/xflr6/graphviz
Source: https://files.pythonhosted.org/packages/source/g/graphviz/graphviz-%{version}.zip
Patch1: python312-syntax-warning.patch
BuildRequires: %{python_module base >= 3.7}
BuildRequires: %{python_module pytest >= 6}
BuildRequires: %{python_module pytest-mock >= 3}
@@ -56,7 +57,7 @@ inspected with its default application. Graphs can also be rendered and
displayed within IPython notebooks.
%prep
%autosetup -n graphviz-%{version}
%autosetup -p1 -n graphviz-%{version}
sed -i '/--cov/d' setup.cfg
sed -i '/^mock_use_standalone_module/d' setup.cfg

View File

@@ -0,0 +1,30 @@
From 5ce9fc5de4f2284baa27d7a8d68ab0885d032868 Mon Sep 17 00:00:00 2001
From: Sebastian Bank <sebastian.bank@uni-leipzig.de>
Date: Tue, 24 Oct 2023 20:39:52 +0200
Subject: [PATCH] expect SyntaxWarning in test_deprecated_escape() under Python
3.12
https://docs.python.org/3.12/whatsnew/3.12.html#other-language-changes
---
tests/test_quoting.py | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
Index: graphviz-0.20.1/tests/test_quoting.py
===================================================================
--- graphviz-0.20.1.orig/tests/test_quoting.py
+++ graphviz-0.20.1/tests/test_quoting.py
@@ -1,3 +1,4 @@
+import sys
import warnings
import pytest
@@ -14,7 +15,8 @@ def test_deprecated_escape(recwarn, char
escape = eval(rf'"\{char}"')
assert len(recwarn) == 1
- w = recwarn.pop(DeprecationWarning)
+ w = recwarn.pop(DeprecationWarning if sys.version_info < (3, 12)
+ else SyntaxWarning)
assert str(w.message).startswith('invalid escape sequence')
assert escape == f'\\{char}'