I want to use Betamax in my tests but I found it actually does not write interactions which lead to exceptions.
Example:
import betamax
import requests
with betamax.Betamax.configure() as config:
config.cassette_library_dir = '.'
session = requests.Session()
with betamax.Betamax(session) as vcr:
vcr.use_cassette('myrun2', record='all')
print session.get('http://127.0.0.1:1').text
Result from application: requests.exceptions.ConnectionError: HTTPConnectionPool(host='127.0.0.1', port=1): Max retries exceeded with url: / (Caused by NewConnectionError('<requests.packages.urllib3.connection.HTTPConnection object at 0x7f643ab562d0>: Failed to establish a new connection: [Errno 111] Connection refused',)) (which is expected).
Written in mytest2.json:
{"http_interactions": [], "recorded_with": "betamax/0.8.0"} which is a rather sad thing because when I try to reply it (replace record='all' with record='none'), it fails with a different error:
betamax.exceptions.BetamaxError: A request was made that could not be handled.
A request was made to http://127.0.0.1:1/ that could not be found in myrun2.
Is here any way to say to betamax to write exceptions from requests as a part of cassette?
Aucun commentaire:
Enregistrer un commentaire