From e0f608a2ed9de68d94f897ef487c10fdfa8da87b3dccf4d4d2c1968c833e91e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Mon, 1 Jun 2020 12:59:27 +0000 Subject: [PATCH] Accepting request 810619 from home:pgajdos:python - use %pytest macro - do not require unittest2 for python3 - added patches unittest2 is not neccessary for python3 + python-deprecation-no-unittest2.patch OBS-URL: https://build.opensuse.org/request/show/810619 OBS-URL: https://build.opensuse.org/package/show/devel:languages:python/python-deprecation?expand=0&rev=13 --- python-deprecation-no-unittest2.patch | 41 +++++++++++++++++++++++++++ python-deprecation.changes | 9 ++++++ python-deprecation.spec | 13 +++++++-- 3 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 python-deprecation-no-unittest2.patch diff --git a/python-deprecation-no-unittest2.patch b/python-deprecation-no-unittest2.patch new file mode 100644 index 0000000..5cfca2e --- /dev/null +++ b/python-deprecation-no-unittest2.patch @@ -0,0 +1,41 @@ +Index: deprecation-2.1.0/tests/test_deprecation.py +=================================================================== +--- deprecation-2.1.0.orig/tests/test_deprecation.py 2020-04-20 16:14:19.000000000 +0200 ++++ deprecation-2.1.0/tests/test_deprecation.py 2020-06-01 13:51:55.484939683 +0200 +@@ -12,14 +12,16 @@ + + # As we unfortunately support Python 2.7, it lacks TestCase.subTest which + # is in 3.4+ or in unittest2 +-import unittest2 ++import unittest ++if not hasattr(unittest.TestCase, "subTest"): ++ import unittest2 as unittest + import warnings + + import deprecation + from datetime import date + + +-class Test_deprecated(unittest2.TestCase): ++class Test_deprecated(unittest.TestCase): + + def test_args_set_on_base_class(self): + args = (1, 2, 3, 4) +@@ -230,7 +232,7 @@ class Test_deprecated(unittest2.TestCase + self.assertEqual(sot.method(), ret_val) + + +-class Test_fail_if_not_removed(unittest2.TestCase): ++class Test_fail_if_not_removed(unittest.TestCase): + + @deprecation.deprecated(deprecated_in="1.0", current_version="2.0") + def _deprecated_method(self): +@@ -259,7 +261,7 @@ class Test_fail_if_not_removed(unittest2 + except AssertionError: + self.fail("A DeprecatedWarning shouldn't cause a failure") + +- @unittest2.expectedFailure ++ @unittest.expectedFailure + @deprecation.fail_if_not_removed + def test_literal_UnsupportedWarning(self): + self._unsupported_method() diff --git a/python-deprecation.changes b/python-deprecation.changes index c5477f9..2516108 100644 --- a/python-deprecation.changes +++ b/python-deprecation.changes @@ -1,3 +1,12 @@ +------------------------------------------------------------------- +Mon Jun 1 11:52:54 UTC 2020 - pgajdos@suse.com + +- use %pytest macro +- do not require unittest2 for python3 +- added patches + unittest2 is not neccessary for python3 + + python-deprecation-no-unittest2.patch + ------------------------------------------------------------------- Wed May 27 05:12:21 UTC 2020 - Steve Kowalik diff --git a/python-deprecation.spec b/python-deprecation.spec index 82e128a..2f35228 100644 --- a/python-deprecation.spec +++ b/python-deprecation.spec @@ -17,6 +17,7 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} +%bcond_without python2 Name: python-deprecation Version: 2.1.0 Release: 0 @@ -25,8 +26,15 @@ License: Apache-2.0 Group: Development/Languages/Python URL: https://github.com/briancurtin/deprecation Source: https://files.pythonhosted.org/packages/source/d/deprecation/deprecation-%{version}.tar.gz +# https://github.com/briancurtin/deprecation/pull/50 +Patch0: python-deprecation-no-unittest2.patch BuildRequires: %{python_module setuptools} -BuildRequires: %{python_module unittest2} +# SECTION test requirements +BuildRequires: %{python_module pytest} +%if %{with python2} +BuildRequires: python-unittest2 +%endif +# /SECTION BuildRequires: fdupes BuildRequires: python-rpm-macros BuildArch: noarch @@ -39,6 +47,7 @@ enable the automation of several things: %prep %setup -q -n deprecation-%{version} +%patch0 -p1 %build @@ -49,7 +58,7 @@ enable the automation of several things: %python_expand %fdupes %{buildroot}%{$python_sitelib} %check -%python_exec setup.py test +%pytest %files %{python_files} %license LICENSE