buildbot / buildbot

@@ -35,8 +35,6 @@
Loading
35 35
36 36
try:
37 37
    import treq
38 -
    implementer(IHttpResponse)(treq.response._Response)
39 -
40 38
except ImportError:
41 39
    treq = None
42 40
@@ -64,6 +62,27 @@
Loading
64 62
        return self._res.url
65 63
66 64
65 +
@implementer(IHttpResponse)
66 +
class TreqResponseWrapper:
67 +
68 +
    def __init__(self, res):
69 +
        self._res = res
70 +
71 +
    def content(self):
72 +
        return self._res.content()
73 +
74 +
    def json(self):
75 +
        return self._res.json()
76 +
77 +
    @property
78 +
    def code(self):
79 +
        return self._res.code
80 +
81 +
    @property
82 +
    def url(self):
83 +
        return self._res.request.absoluteURI.decode()
84 +
85 +
67 86
class HTTPClientService(service.SharedService):
68 87
    """A SharedService class that can make http requests to remote services.
69 88
@@ -202,7 +221,7 @@
Loading
202 221
        kwargs['agent'] = self._agent
203 222
204 223
        res = yield getattr(treq, method)(url, **kwargs)
205 -
        return IHttpResponse(res)
224 +
        return IHttpResponse(TreqResponseWrapper(res))
206 225
207 226
    # lets be nice to the auto completers, and don't generate that code
208 227
    def get(self, ep, **kwargs):
Files Coverage
master/buildbot 92.52%
worker/buildbot_worker 86.38%
Project Totals (345 files) 92.07%
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice is representing the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice is representing the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block is represented by the number of statements and the coverage, respectively.
Loading