with vcr.use_cassette(str(tmpdir.join('data.yaml'))) as cass:
yield get(client, 'http://httpbin.org/get')
assert cass.play_count == 1
+
+
+@pytest.mark.gen_test
+def test_request_time_is_set(get_client, tmpdir):
+ '''Ensures that the request_time on HTTPResponses is set.'''
+
+ with vcr.use_cassette(str(tmpdir.join('data.yaml'))):
+ client = get_client()
+ response = yield get(client, 'http://httpbin.org/get')
+ assert response.request_time is not None
+
+ with vcr.use_cassette(str(tmpdir.join('data.yaml'))) as cass:
+ client = get_client()
+ response = yield get(client, 'http://httpbin.org/get')
+ assert response.request_time is not None
+ assert cass.play_count == 1
"that is not yet supported by VCR.py. Please make the "
"request outside a VCR.py context." % repr(request)
),
+ request_time=self.io_loop.time() - request.start_time,
)
return callback(response)
headers=headers,
buffer=BytesIO(vcr_response['body']['string']),
effective_url=vcr_response.get('url'),
+ request_time=self.io_loop.time() - request.start_time,
)
return callback(response)
else:
"your current record mode (%r)."
% (vcr_request, cassette._path, cassette.record_mode)
),
+ request_time=self.io_loop.time() - request.start_time,
)
return callback(response)