Blame SOURCES/Make-webtest-an-optional-dependency.patch

52ae74
From 2164f10fe5d992006f42c4a8d682f23b04ffbf12 Mon Sep 17 00:00:00 2001
52ae74
From: Robbie Harwood <rharwood@redhat.com>
52ae74
Date: Thu, 9 Aug 2018 14:57:56 -0400
52ae74
Subject: [PATCH] Make webtest an optional dependency
52ae74
52ae74
Resolves: #38
52ae74
(cherry picked from commit c0bee88c60deb176d420d90447d24c370d70727a)
52ae74
---
52ae74
 tests.py | 7 ++++++-
52ae74
 1 file changed, 6 insertions(+), 1 deletion(-)
52ae74
52ae74
diff --git a/tests.py b/tests.py
52ae74
index 992529f..c2b1fc0 100644
52ae74
--- a/tests.py
52ae74
+++ b/tests.py
52ae74
@@ -33,7 +33,11 @@ from dns.rdataclass import IN as RDCLASS_IN
52ae74
 from dns.rdatatype import SRV as RDTYPE_SRV
52ae74
 from dns.rdtypes.IN.SRV import SRV
52ae74
 
52ae74
-from webtest import TestApp as WebTestApp
52ae74
+try:
52ae74
+    from webtest import TestApp as WebTestApp
52ae74
+except ImportError:
52ae74
+    print("webtest not installed!  Tests will be skipped")
52ae74
+    WebTestApp = "skip"
52ae74
 
52ae74
 import kdcproxy
52ae74
 from kdcproxy import codec
52ae74
@@ -45,6 +49,7 @@ HERE = os.path.dirname(os.path.abspath(__file__))
52ae74
 KRB5_CONFIG = os.path.join(HERE, 'tests.krb5.conf')
52ae74
 
52ae74
 
52ae74
+@unittest.skipIf(WebTestApp == "skip", "webtest not installed")
52ae74
 class KDCProxyWSGITests(unittest.TestCase):
52ae74
     addrinfo = [
52ae74
         (2, 1, 6, '', ('128.66.0.2', 88)),