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

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