diff --git a/py39.patch b/py39.patch new file mode 100644 index 0000000..40d97cd --- /dev/null +++ b/py39.patch @@ -0,0 +1,60 @@ +From 55165f7b1a622577801f8d6c2bd3d0f16555be4b Mon Sep 17 00:00:00 2001 +From: podhmo +Date: Sun, 28 Mar 2021 14:27:35 +0900 +Subject: [PATCH] Fix test for py39 (#75) + +* test: remove try-except + +* test: fix tests (work-around) +--- + prestring/tests/test_lazy_object.py | 33 +++++++++++++++++------------ + 1 file changed, 20 insertions(+), 13 deletions(-) + +diff --git a/prestring/tests/test_lazy_object.py b/prestring/tests/test_lazy_object.py +index f528009..a41457f 100644 +--- a/prestring/tests/test_lazy_object.py ++++ b/prestring/tests/test_lazy_object.py +@@ -29,23 +29,30 @@ def test_with_actual_types(self): + self.assertEqual(str(target), "x: int, y: bool, *") + + def test_with_actual_types2(self): +- try: +- import typing as t +- +- target = self._makeOne( +- ["x", "y", "z"], +- types={ +- "x": int, +- "y": t.Optional[int], +- "z": t.Sequence[t.Optional[int]], +- }, +- ) ++ import typing as t ++ ++ target = self._makeOne( ++ ["x", "y", "z"], ++ types={ ++ "x": int, ++ "y": t.Optional[int], ++ "z": t.Sequence[t.Optional[int]], ++ }, ++ ) ++ ++ # TODO: fix, this is work-around ++ import sys ++ ++ if (3, 9) > sys.version_info: + self.assertEqual( + str(target), + "x: int, y: 'typing.Union[int, NoneType]', z: 'typing.Sequence[typing.Union[int, NoneType]]'", + ) +- except ImportError: +- pass ++ else: ++ self.assertEqual( ++ str(target), ++ "x: int, y: 'typing.Optional[int]', z: 'typing.Sequence[typing.Optional[int]]'", ++ ) + + + @test_target("prestring:LazyKeywords") diff --git a/python-prestring.changes b/python-prestring.changes index 1035b14..0bf6b5a 100644 --- a/python-prestring.changes +++ b/python-prestring.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Wed Apr 28 11:48:04 UTC 2021 - Markéta Machová + +- Add py39.patch to fix tests + ------------------------------------------------------------------- Mon Aug 17 07:11:04 UTC 2020 - Tomáš Chvátal diff --git a/python-prestring.spec b/python-prestring.spec index 62047ab..0e106ec 100644 --- a/python-prestring.spec +++ b/python-prestring.spec @@ -1,7 +1,7 @@ # # spec file for package python-prestring # -# Copyright (c) 2020 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 @@ -26,6 +26,8 @@ Summary: Python source code generation library License: MIT URL: https://github.com/podhmo/prestring Source: https://github.com/podhmo/prestring/archive/%{version}.tar.gz#/prestring-%{version}.tar.gz +# PATCH-FIX-UPSTREAM https://github.com/podhmo/prestring/commit/55165f7b1a622577801f8d6c2bd3d0f16555be4b Fix test for py39 (#75) +Patch0: py39.patch BuildRequires: %{python_module setuptools} BuildRequires: fdupes BuildRequires: python-rpm-macros @@ -41,6 +43,7 @@ Python source code generation library (with overuse with-syntax). %prep %setup -q -n prestring-%{version} +%autopatch -p1 %build %python_build