Accepting request 810582 from home:pgajdos:python

- for python3, drop dependency on unittest2
- added patches
  + remove_unittest2.patch

OBS-URL: https://build.opensuse.org/request/show/810582
OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-astor?expand=0&rev=17
This commit is contained in:
Matej Cepl 2020-06-01 09:52:06 +00:00 committed by Git OBS Bridge
parent 3c044d3e01
commit 74985eaec3
3 changed files with 36 additions and 1 deletions

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri May 29 12:49:31 UTC 2020 - pgajdos@suse.com
- for python3, drop dependency on unittest2
- added patches
+ remove_unittest2.patch
-------------------------------------------------------------------
Fri Apr 3 21:34:35 UTC 2020 - Marcus Rueckert <mrueckert@suse.de>

View File

@ -27,12 +27,17 @@ URL: https://github.com/berkerpeksag/astor
Source: https://github.com/berkerpeksag/astor/archive/%{version}.tar.gz#/astor-%{version}.tar.gz
# https://github.com/berkerpeksag/astor/pull/177
Patch0: remove_nose.patch
# https://github.com/berkerpeksag/astor/issues/90
Patch1: remove_unittest2.patch
BuildRequires: %{python_module pytest}
BuildRequires: %{python_module setuptools}
BuildRequires: fdupes
BuildRequires: python-rpm-macros
BuildArch: noarch
# SECTION test requirements
%if %{with python2}
BuildRequires: %{python_module unittest2}
%endif
# /SECTION
%python_subpackages
@ -63,6 +68,9 @@ There are some other similar libraries, but astor focuses on the following areas
%prep
%setup -q -n astor-%{version}
%patch0 -p1
%if 0%{?suse_version} <= 1500
%patch1 -p1
%endif
%build
# ugly fix for the use of /usr/bin/env
@ -77,7 +85,7 @@ chmod a-x astor/rtrip.py
%python_expand chmod 755 %{buildroot}%{$python_sitelib}/astor/rtrip.py
%check
%python_exec -m unittest2 discover -v
%pytest tests
%files %{python_files}
%doc AUTHORS README.rst docs/*.rst

20
remove_unittest2.patch Normal file
View File

@ -0,0 +1,20 @@
Index: astor-0.8.1/tests/test_misc.py
===================================================================
--- astor-0.8.1.orig/tests/test_misc.py 2019-12-10 02:48:43.000000000 +0100
+++ astor-0.8.1/tests/test_misc.py 2020-05-29 14:40:33.063783987 +0200
@@ -26,6 +26,7 @@ class PublicAPITestCase(unittest.TestCas
def test_aliases(self):
self.assertIs(astor.parse_file, astor.code_to_ast.parse_file)
+ @unittest.skip("unittest2 required")
def test_codegen_from_root(self):
with self.assertWarns(DeprecationWarning) as cm:
astor = import_fresh_module('astor')
@@ -37,6 +38,7 @@ class PublicAPITestCase(unittest.TestCas
'astor.codegen is deprecated. Please use astor.code_gen.'
)
+ @unittest.skip("unittest2 required")
def test_codegen_as_submodule(self):
with self.assertWarns(DeprecationWarning) as cm:
import astor.codegen