File python-deprecation-no-unittest2.patch of Package python-deprecation
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()