-
Notifications
You must be signed in to change notification settings - Fork 62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
User typos can trigger baroque exceptions #183
Comments
Something like: |
We need more information to help debug this. |
Groan, after further debugging above is the result of:
Notice the trailing comma on the match_requests_on value. The comma makes the value a tuple, which then throws the TypeError as described above when attempting to update the set based on a tuple of (list, None). Obviously my fault. Some time might be saved for future souls if the type of match_requests_on is checked prior to update there and a warning with a hint to check for trailing comma provided? I find it's trickier to debug pytests with VSCode because I haven't found a way to run the debugger against pytest with justMyCode=False. I tracked down above using print statements in the betamax lib 😮 |
I personally abhor the global configuration that I stole from VCR, and don't want to implement something that wraps dictionaries to do type-checking to be totally transparent. I'm worried, also, that checking the type before calling That said, I do believe there should be someway to protect users from typos like this. Perhaps if we introduce a |
betamax/src/betamax/adapter.py
Line 99 in 77e61d7
When I use a default cassette configuration with a modified match_on (running via pytest), I get an unhashable type at the line referenced above.
It looks to me like it's trying to update a dict from a list? Per the comment, I tried changing
config.default_cassette_options['match_requests_on'] = ['method', 'uri', 'jsonbody'],
to
config.default_cassette_options['match_requests_on'] = set(['method', 'uri', 'jsonbody']),
with no effect.
The text was updated successfully, but these errors were encountered: