From 9ce59da21de587e074a580ce4ba0da076bb056ba45499b39b4a81a234d4eae50 Mon Sep 17 00:00:00 2001 From: Matej Cepl Date: Fri, 12 Mar 2021 13:37:18 +0000 Subject: [PATCH] - Add python39-build.patch to avoid test failures (gh#PythonCharmers/python-future#578). OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-future?expand=0&rev=31 --- python-future.changes | 6 +++ python-future.spec | 7 +++- python39-build.patch | 88 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 99 insertions(+), 2 deletions(-) create mode 100644 python39-build.patch diff --git a/python-future.changes b/python-future.changes index c942662..30981dd 100644 --- a/python-future.changes +++ b/python-future.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Fri Mar 12 13:35:13 UTC 2021 - Matej Cepl + +- Add python39-build.patch to avoid test failures + (gh#PythonCharmers/python-future#578). + ------------------------------------------------------------------- Thu Dec 3 22:24:41 UTC 2020 - Benjamin Greiner diff --git a/python-future.spec b/python-future.spec index 396b0c3..bdc19ae 100644 --- a/python-future.spec +++ b/python-future.spec @@ -1,7 +1,7 @@ # # spec file for package python-future # -# Copyright (c) 2019 SUSE LLC +# Copyright (c) 2021 SUSE LLC # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -30,6 +30,9 @@ Source100: python-future-rpmlintrc Patch0: python38-pow.patch # UPSTREAM ISSUE gh#PythonCharmers/python-future#508 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 BuildRequires: %{python_module pytest} BuildRequires: %{python_module setuptools} BuildRequires: fdupes @@ -40,7 +43,7 @@ BuildRequires: %{python_module dbm} BuildRequires: python3-dbm %endif Requires(post): update-alternatives -Requires(preun): update-alternatives +Requires(preun):update-alternatives BuildArch: noarch %python_subpackages diff --git a/python39-build.patch b/python39-build.patch new file mode 100644 index 0000000..7094721 --- /dev/null +++ b/python39-build.patch @@ -0,0 +1,88 @@ +From c341d5497788923cc6ea0bd1358279f2147aa167 Mon Sep 17 00:00:00 2001 +From: Alexander Shadchin +Date: Sun, 15 Nov 2020 13:01:39 +0300 +Subject: [PATCH 1/6] Add support Python 3.9 + +--- + src/future/moves/_dummy_thread.py | 5 ++++- + src/future/standard_library/__init__.py | 2 +- + tests/test_future/test_builtins.py | 2 ++ + tests/test_future/test_standard_library.py | 3 ++- + tests/test_future/test_urllib2.py | 3 +++ + tests/test_future/test_urllib_toplevel.py | 5 +++-- + 6 files changed, 15 insertions(+), 5 deletions(-) + +--- a/src/future/moves/_dummy_thread.py ++++ b/src/future/moves/_dummy_thread.py +@@ -2,7 +2,10 @@ from __future__ import absolute_import + from future.utils import PY3 + + if PY3: +- from _dummy_thread import * ++ try: ++ from _dummy_thread import * ++ except ImportError: ++ from _thread import * + else: + __future_module__ = True + from dummy_thread import * +--- a/src/future/standard_library/__init__.py ++++ b/src/future/standard_library/__init__.py +@@ -125,7 +125,7 @@ RENAMES = { + # 'Tkinter': 'tkinter', + '_winreg': 'winreg', + 'thread': '_thread', +- 'dummy_thread': '_dummy_thread', ++ 'dummy_thread': '_dummy_thread' if sys.version_info < (3, 9) else '_thread', + # 'anydbm': 'dbm', # causes infinite import loop + # 'whichdb': 'dbm', # causes infinite import loop + # anydbm and whichdb are handled by fix_imports2 +--- a/tests/test_future/test_standard_library.py ++++ b/tests/test_future/test_standard_library.py +@@ -422,7 +422,8 @@ class TestStandardLibraryReorganization( + + def test_underscore_prefixed_modules(self): + import _thread +- import _dummy_thread ++ if sys.version_info < (3, 9): ++ import _dummy_thread + import _markupbase + self.assertTrue(True) + +--- a/tests/test_future/test_urllib_toplevel.py ++++ b/tests/test_future/test_urllib_toplevel.py +@@ -781,8 +781,9 @@ class UnquotingTests(unittest.TestCase): + "%s" % result) + self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, None) + self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, ()) +- with support.check_warnings(('', BytesWarning), quiet=True): +- self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b'')) ++ if sys.version_info < (3, 9): ++ with support.check_warnings(('', BytesWarning), quiet=True): ++ self.assertRaises((TypeError, AttributeError), urllib_parse.unquote, bytes(b'')) + + def test_unquoting_badpercent(self): + # Test unquoting on bad percent-escapes +--- a/tests/test_future/test_builtins.py ++++ b/tests/test_future/test_builtins.py +@@ -1305,6 +1305,8 @@ class BuiltinTest(unittest.TestCase): + self.assertAlmostEqual(pow(-1, 1/3), 0.5 + 0.8660254037844386j) + + # Raises TypeError in Python < v3.5, ValueError in v3.5: ++ if sys.version_info < (3, 8): ++ self.assertRaises((TypeError, ValueError), pow, -1, -2, 3) + self.assertRaises(ValueError, pow, 1, 2, 0) + + self.assertRaises(TypeError, pow) +--- a/tests/test_future/test_urllib2.py ++++ b/tests/test_future/test_urllib2.py +@@ -710,6 +710,9 @@ class HandlerTests(unittest.TestCase): + ("ftp://localhost/baz.gif;type=a", + "localhost", ftplib.FTP_PORT, "", "", "A", + [], "baz.gif", None), ++ ("ftp://localhost/baz.gif", ++ "localhost", ftplib.FTP_PORT, "", "", "I", ++ [], "baz.gif", "image/gif"), + ]: + req = Request(url) + req.timeout = None