File python-deprecation-no-unittest2.patch of Package python-deprecation

From e13e23068cb8d653a02a434a159e8b0b7226ffd6 Mon Sep 17 00:00:00 2001
From: Jonathan Ringer <jonringer117@gmail.com>
Date: Tue, 11 Jan 2022 14:23:03 -0800
Subject: [PATCH] Make unittest optional for python3.5+

---
 docs-requirements.txt     | 2 +-
 test-requirements.txt     | 2 +-
 tests/test_deprecation.py | 7 ++++++-
 tox.ini                   | 2 +-
 4 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/tests/test_deprecation.py b/tests/test_deprecation.py
index 0fd29b3..14e9510 100644
--- a/tests/test_deprecation.py
+++ b/tests/test_deprecation.py
@@ -12,7 +12,12 @@
 
 # As we unfortunately support Python 2.7, it lacks TestCase.subTest which
 # is in 3.4+ or in unittest2
-import unittest2
+try:
+    import unittest2
+except ImportError:
+    import unittest
+    unittest2 = unittest
+
 import warnings
 
 import deprecation
openSUSE Build Service is sponsored by