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