Show More
@@ -16,10 +16,6 b' import re' | |||||
16 | import requests |
|
16 | import requests | |
17 | import shutil |
|
17 | import shutil | |
18 | from subprocess import call, check_call, check_output, PIPE, STDOUT, CalledProcessError |
|
18 | from subprocess import call, check_call, check_output, PIPE, STDOUT, CalledProcessError | |
19 | try: |
|
|||
20 | from urllib.request import urlopen |
|
|||
21 | except ImportError: |
|
|||
22 | from urllib2 import urlopen |
|
|||
23 |
|
19 | |||
24 | import gh_auth |
|
20 | import gh_auth | |
25 |
|
21 | |||
@@ -72,8 +68,7 b' def setup():' | |||||
72 |
|
68 | |||
73 | def get_pull_request(num): |
|
69 | def get_pull_request(num): | |
74 | url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=gh_project, num=num) |
|
70 | url = "https://api.github.com/repos/{project}/pulls/{num}".format(project=gh_project, num=num) | |
75 | response = urlopen(url).read().decode('utf-8') |
|
71 | return json.loads(requests.get(url).text) | |
76 | return json.loads(response) |
|
|||
77 |
|
72 | |||
78 | missing_libs_re = re.compile(r"Tools and libraries NOT available at test time:\n" |
|
73 | missing_libs_re = re.compile(r"Tools and libraries NOT available at test time:\n" | |
79 | r"\s*(.*?)\n") |
|
74 | r"\s*(.*?)\n") | |
@@ -125,8 +120,8 b' def post_gist(content, description=\'IPython test log\', filename="results.log"):' | |||||
125 | } |
|
120 | } | |
126 | }).encode('utf-8') |
|
121 | }).encode('utf-8') | |
127 |
|
122 | |||
128 |
response = |
|
123 | response = requests.post("https://api.github.com/gists", data=post_data) | |
129 |
response_data = json.loads(response. |
|
124 | response_data = json.loads(response.text) | |
130 | return response_data['html_url'] |
|
125 | return response_data['html_url'] | |
131 |
|
126 | |||
132 | def markdown_format(pr, results): |
|
127 | def markdown_format(pr, results): | |
@@ -159,7 +154,7 b' def post_results_comment(pr, results, num):' | |||||
159 | auth_token = gh_auth.get_auth_token() |
|
154 | auth_token = gh_auth.get_auth_token() | |
160 | headers = {'Authorization': 'token ' + auth_token} |
|
155 | headers = {'Authorization': 'token ' + auth_token} | |
161 | r = requests.post(url, data=payload, headers=headers) |
|
156 | r = requests.post(url, data=payload, headers=headers) | |
162 |
|
157 | |||
163 |
|
158 | |||
164 | if __name__ == '__main__': |
|
159 | if __name__ == '__main__': | |
165 | import sys |
|
160 | import sys |
General Comments 0
You need to be logged in to leave comments.
Login now