Blame SOURCES/0003-Allow-skipping-purl-tests-if-it-is-not-present.patch

fd16c0
From b1844f12934f7a1554fdfaf26cb05261d222a1da Mon Sep 17 00:00:00 2001
fd16c0
From: Jamie Lennox <jamielennox@gmail.com>
fd16c0
Date: Wed, 4 Dec 2019 22:16:16 +1100
fd16c0
Subject: [PATCH] Allow skipping purl tests if it is not present
fd16c0
fd16c0
Purl is not available in some packaging scenarios, like on fedora.
fd16c0
Easiest to just ignore this one if not present.
fd16c0
---
fd16c0
 tests/test_adapter.py | 9 ++++++++-
fd16c0
 1 file changed, 8 insertions(+), 1 deletion(-)
fd16c0
fd16c0
diff --git a/tests/test_adapter.py b/tests/test_adapter.py
fd16c0
index 70d0752..b6aa845 100644
fd16c0
--- a/tests/test_adapter.py
fd16c0
+++ b/tests/test_adapter.py
fd16c0
@@ -13,7 +13,11 @@
fd16c0
 import json
fd16c0
 import re
fd16c0
fd16c0
-import purl
fd16c0
+try:
fd16c0
+    import purl
fd16c0
+except ImportError:
fd16c0
+    purl = None
fd16c0
+
fd16c0
 import requests
fd16c0
 import six
fd16c0
 from six.moves.urllib import parse as urlparse
fd16c0
@@ -329,6 +333,9 @@ class SessionAdapterTests(base.TestCase):
fd16c0
             self.assertEqual('resp', resp.text)
fd16c0
fd16c0
     def test_with_purl(self):
fd16c0
+        if purl is None:
fd16c0
+            self.skipTest('purl is not present')
fd16c0
+
fd16c0
         self.adapter.register_uri('GET',
fd16c0
                                   purl.URL('mock://www.tester.com/a'),
fd16c0
                                   text='resp')
fd16c0
--
fd16c0
2.21.0
fd16c0