From 7384f578799d258668fd94b9534d17e8ec9f3a61 Mon Sep 17 00:00:00 2001 From: chenditang Date: Wed, 24 Jun 2020 15:12:23 +0800 Subject: [PATCH] test: fix tests when using Python-3.9a6 --- babel.spec | 13 ++++- fix-tests-when-using-Python-3.9a6.patch | 71 +++++++++++++++++++++++++ 2 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 fix-tests-when-using-Python-3.9a6.patch diff --git a/babel.spec b/babel.spec index dfe711c..03bf953 100644 --- a/babel.spec +++ b/babel.spec @@ -1,11 +1,13 @@ Name: babel Version: 2.7.0 -Release: 1 +Release: 2 Summary: Tools for internationalizing and localizing Python applications License: BSD URL: http://babel.pocoo.org/ Source0: https://files.pythonhosted.org/packages/source/B/Babel/Babel-%{version}.tar.gz -Patch0: babel-2.3.4-remove-pytz-version.patch + +Patch0000: babel-2.3.4-remove-pytz-version.patch +Patch0001: fix-tests-when-using-Python-3.9a6.patch BuildArch: noarch @@ -70,6 +72,7 @@ rm -f "$BUILDDIR/html/.buildinfo" %py3_install %check +export TZ=America/New_York %{__python2} -m pytest %{__python3} -m pytest @@ -98,6 +101,12 @@ rm -f "$BUILDDIR/html/.buildinfo" %doc built-docs/html/* %changelog +* Wed Jun 24 2020 chenditang - 2.7.0-2 +- Type:enhancement +- ID:NA +- SUG:NA +- DESC:fix tests when using Python 3.9a6 + * Fri Oct 11 2019 hanzhijun - 2.7.0-1 - Type:enhancement - ID:NA diff --git a/fix-tests-when-using-Python-3.9a6.patch b/fix-tests-when-using-Python-3.9a6.patch new file mode 100644 index 0000000..588e571 --- /dev/null +++ b/fix-tests-when-using-Python-3.9a6.patch @@ -0,0 +1,71 @@ +From 7bdaa28a55e8d8228d5434effa4b1473ab7b3669 Mon Sep 17 00:00:00 2001 +From: Felix Schwarz +Date: Tue, 5 May 2020 08:05:56 +0000 +Subject: [PATCH] fix tests when using Python 3.9a6 + +In Python 3.9a6 integer values for future flags were changed to prevent +collision with compiler flags. We need to retrieve these at runtime so +the test suite works with Python <= 3.8 as well as Python 3.9. +--- + tests/test_util.py | 17 ++++++++++++----- + 1 file changed, 12 insertions(+), 5 deletions(-) + +diff --git a/tests/test_util.py b/tests/test_util.py +index a6a4450..b9343aa 100644 +--- a/tests/test_util.py ++++ b/tests/test_util.py +@@ -11,6 +11,7 @@ + # individuals. For the exact contribution history, see the revision + # history and logs, available at http://babel.edgewall.org/log/. + ++import __future__ + import unittest + + import pytest +@@ -20,6 +21,12 @@ from babel._compat import BytesIO + from babel.util import parse_future_flags + + ++class _FF: ++ division = __future__.division.compiler_flag ++ print_function = __future__.print_function.compiler_flag ++ with_statement = __future__.with_statement.compiler_flag ++ unicode_literals = __future__.unicode_literals.compiler_flag ++ + def test_distinct(): + assert list(util.distinct([1, 2, 1, 3, 4, 4])) == [1, 2, 3, 4] + assert list(util.distinct('foobar')) == ['f', 'o', 'b', 'a', 'r'] +@@ -70,25 +77,25 @@ def test_parse_encoding_non_ascii(): + from __future__ import print_function, + division, with_statement, + unicode_literals +-''', 0x10000 | 0x2000 | 0x8000 | 0x20000), ++''', _FF.print_function | _FF.division | _FF.with_statement | _FF.unicode_literals), + (''' + from __future__ import print_function, division + print('hello') +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + (''' + from __future__ import print_function, division, unknown,,,,, + print 'hello' +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + (''' + from __future__ import ( + print_function, + division) +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + (''' + from __future__ import \\ + print_function, \\ + division +-''', 0x10000 | 0x2000), ++''', _FF.print_function | _FF.division), + ]) + def test_parse_future(source, result): + fp = BytesIO(source.encode('latin-1')) +-- +1.8.3.1 + -- Gitee