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

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