forked from pool/python-deprecation
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
This commit is contained in:
parent
fda0b0aa0b
commit
e0f608a2ed
41
python-deprecation-no-unittest2.patch
Normal file
41
python-deprecation-no-unittest2.patch
Normal file
@ -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()
|
@ -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 <steven.kowalik@suse.com>
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user