-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
pytest crashes if raised exception is not hashable #4514
Comments
This is an issue with the latest version of pytest ( FWIW, here are my environment details:
|
as per traceback this looks like a bug in the python stdlib that seems to be fixed in python 3.7 |
The fix has also been backported to 3.6, which is still in the upstream bugfix period, so this is a rare upstream bug that only affects 3.4 and 3.5. Given that there's nothing sensible we can do to rescue exceptions in the general case, I'd rather not add a best-effort patch that will only obscure the real problem when it fails - especially when it's easy to avoid defining unhashable exceptions! |
Ok, good to hear that Python 3.6 will be fixed soon. Thanks very much for looking into it, and for the explanation, @Zac-HD and @RonnyPfannschmidt! |
It's been fixed since October 2017 (python/cpython#4024), meaning 3.6.4 and later are fine 😄 |
If a test fails with a non-hashable exception,
pytest
crashes.[Edit: No crash under python 3.7; only under 3.6 (and maybe others).]
Here's a simple example:
Click below for the traceback I see when running
pytest test.py
(using python 3.6).Click for traceback
Admittedly, it's rare for exceptions not to be hashable. But for a real-world example, see this
jsonschema
issue:Is this known behavior? Is there any easy change that would permit unhashable exceptions?
The text was updated successfully, but these errors were encountered: