1
0
forked from pool/python-future

Accepting request 1096863 from devel:languages:python

- Add 619-test-zero-byte.patch to fix
  gh#PythonCharmers/python-future#618.

OBS-URL: https://build.opensuse.org/request/show/1096863
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/python-future?expand=0&rev=18
This commit is contained in:
Fabian Vogt 2023-07-06 16:27:47 +00:00 committed by Git OBS Bridge
commit 576cb5bb4d
3 changed files with 83 additions and 5 deletions

69
619-test-zero-byte.patch Normal file
View File

@ -0,0 +1,69 @@
From a6135542dffb6b1b8254d6daac779d119d4fc08c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <thrnciar@redhat.com>
Date: Wed, 17 May 2023 14:03:26 +0200
Subject: [PATCH 1/2] Adjust tests to the repr changes in CPython
---
tests/test_future/test_backports.py | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/tests/test_future/test_backports.py b/tests/test_future/test_backports.py
index 63b1afea..5d46b115 100644
--- a/tests/test_future/test_backports.py
+++ b/tests/test_future/test_backports.py
@@ -599,8 +599,12 @@ def test_yaml_linkage(self):
def test_repr(self):
od = OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])
- self.assertEqual(repr(od),
- "OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])")
+ if sys.version_info[0] == 3 and sys.version_info[1] >= 12:
+ self.assertEqual(repr(od),
+ "OrderedDict({'c': 1, 'b': 2, 'a': 3, 'd': 4, 'e': 5, 'f': 6})")
+ else:
+ self.assertEqual(repr(od),
+ "OrderedDict([('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)])")
self.assertEqual(eval(repr(od)), od)
self.assertEqual(repr(OrderedDict()), "OrderedDict()")
@@ -608,8 +612,12 @@ def test_repr_recursive(self):
# See issue #9826
od = OrderedDict.fromkeys('abc')
od['x'] = od
- self.assertEqual(repr(od),
- "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])")
+ if sys.version_info[0] == 3 and sys.version_info[1] >= 12:
+ self.assertEqual(repr(od),
+ "OrderedDict({'a': None, 'b': None, 'c': None, 'x': ...})")
+ else:
+ self.assertEqual(repr(od),
+ "OrderedDict([('a', None), ('b', None), ('c', None), ('x', ...)])")
def test_setdefault(self):
pairs = [('c', 1), ('b', 2), ('a', 3), ('d', 4), ('e', 5), ('f', 6)]
From d7dc44e88b77fea57b9001421428cd7d95abb3bf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Hrn=C4=8Diar?= <thrnciar@redhat.com>
Date: Wed, 17 May 2023 14:42:09 +0200
Subject: [PATCH 2/2] Adjust test to the change in CPython, parser now raises
SyntaxError instead of ValueError when source code contains null bytes
---
tests/test_future/test_builtins.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/tests/test_future/test_builtins.py b/tests/test_future/test_builtins.py
index 3921a608..d41d1254 100644
--- a/tests/test_future/test_builtins.py
+++ b/tests/test_future/test_builtins.py
@@ -523,8 +523,8 @@ def test_compile(self):
self.assertRaises(TypeError, compile)
self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'badmode')
self.assertRaises(ValueError, compile, 'print(42)\n', '<string>', 'single', 0xff)
- # Raises TypeError in Python < v3.5, ValueError in v3.5:
- self.assertRaises((TypeError, ValueError), compile, chr(0), 'f', 'exec')
+ # Raises TypeError in Python < v3.5, ValueError in v3.5, SyntaxError in >= 3.12:
+ self.assertRaises((TypeError, ValueError, SyntaxError), compile, chr(0), 'f', 'exec')
self.assertRaises(TypeError, compile, 'pass', '?', 'exec',
mode='eval', source='0', filename='tmp')
compile('print("\xe5")\n', '', 'exec')

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Tue Jul 4 22:14:59 UTC 2023 - Matej Cepl <mcepl@suse.com>
- Add 619-test-zero-byte.patch to fix
gh#PythonCharmers/python-future#618.
-------------------------------------------------------------------
Fri Apr 21 12:25:35 UTC 2023 - Dirk Müller <dmueller@suse.com>

View File

@ -33,8 +33,12 @@ Patch1: future-correct-mimetype.patch
# PATCH-FIX-UPSTREAM python39-build.patch gh#PythonCharmers/python-future#578 mcepl@suse.com
# Overcome incompatibilites with python 3.9
Patch2: python39-build.patch
# PATCH-FIX-UPSTREAM 619-test-zero-byte.patch gh#PythonCharmers/python-future#618 mcepl@suse.com
# incompatibilities with 3.11.4
Patch3: 619-test-zero-byte.patch
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
%if 0%{suse_version} >= 1550 || (0%{suse_version} == 1500 && 0%{?sle_version} >= 150400)
@ -53,15 +57,14 @@ It allows you to use a single Python 3.x-compatible codebase to
support both Python 2 and Python 3.
%prep
%setup -q -n future-%{version}
%autopatch -p1
%autosetup -p1 -n future-%{version}
sed -i -e '/^#!\//, 1d' src/future/backports/test/pystone.py
%build
%python_build
%pyproject_wheel
%install
%python_install
%pyproject_install
%python_clone -a %{buildroot}%{_bindir}/futurize
%python_clone -a %{buildroot}%{_bindir}/pasteurize