File: 05-old-urllib3.patch

package info (click to toggle)
python-wsgi-intercept 1.1.2-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 276 kB
  • ctags: 218
  • sloc: python: 1,074; makefile: 205
file content (35 lines) | stat: -rw-r--r-- 1,181 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
Description: skip requests lib tests, if urllib3 is too old
Author: Dimitri John Ledkov <xnox@ubuntu.com>

Index: python-wsgi-intercept/test/test_requests.py
===================================================================
--- python-wsgi-intercept.orig/test/test_requests.py
+++ python-wsgi-intercept/test/test_requests.py
@@ -1,6 +1,11 @@
 import os
 import py.test
-from wsgi_intercept import requests_intercept, WSGIAppError
+
+# Requests interceptor requires 1.8 urllib3.
+import urllib3
+pytestmark = py.test.mark.skipif(hasattr(urllib3, 'connection') == False,
+                                 reason="requires urllib3 1.8+")
+
 from test import wsgi_app
 from test.install import installer_class
 import requests
@@ -8,8 +13,12 @@ from requests.exceptions import Connecti
 
 HOST = 'some_hopefully_nonexistant_domain'
 
-InstalledApp = installer_class(requests_intercept)
-
+try:
+    from wsgi_intercept import requests_intercept, WSGIAppError
+    InstalledApp = installer_class(requests_intercept)
+except ImportError:
+    if hasattr(urllib3, 'connection'):
+        raise
 
 def test_http():
     with InstalledApp(wsgi_app.simple_app, host=HOST, port=80) as app: