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