Browse Source

Merge "Switch to requests to support proxying of 'https'"

tags/1.0.0
Jenkins 4 years ago
parent
commit
5df45d4fd2
1 changed files with 5 additions and 4 deletions
  1. 5
    4
      git_review/tests/__init__.py

+ 5
- 4
git_review/tests/__init__.py View File

@@ -21,15 +21,14 @@ import sys
21 21
 if sys.version < '3':
22 22
     import urllib
23 23
     import urlparse
24
-    urlopen = urllib.urlopen
25 24
     urlparse = urlparse.urlparse
26 25
 else:
27 26
     import urllib.parse
28 27
     import urllib.request
29
-    urlopen = urllib.request.urlopen
30 28
     urlparse = urllib.parse.urlparse
31 29
 
32 30
 import fixtures
31
+import requests
33 32
 import testtools
34 33
 from testtools import content
35 34
 
@@ -60,8 +59,10 @@ class GerritHelpers(object):
60 59
 
61 60
         if not os.path.exists(self.gerrit_war):
62 61
             print("Downloading Gerrit binary from %s..." % WAR_URL)
63
-            resp = urlopen(WAR_URL)
64
-            utils.write_to_file(self.gerrit_war, resp.read())
62
+            resp = requests.get(WAR_URL)
63
+            if resp.status_code != 200:
64
+                raise RuntimeError("Problem requesting Gerrit war")
65
+            utils.write_to_file(self.gerrit_war, resp.content)
65 66
             print("Saved to %s" % self.gerrit_war)
66 67
 
67 68
     def init_gerrit(self):

Loading…
Cancel
Save