pytest.raises 3.5.0 breaks for exception classes that look iterable (e.g. spyne.error.RequestNotAllowed) #3372
I recently update to pytest 3.5.0 and use it to test applications that use spyne.
Unfortunately, my tests that have code like
import pytest from spyne.errors import RequestNotAllowed, InvalidCredentialsError import mymodule def test_a(): with pytest.raises(RequestNotAllowed): mymodule.func_that_raises_request_not_allowed() def test_b(): with pytest.raises(InvalidCredentialsError): mymodule.func_that_raises_invalid_credentials_error()
now break in the lines starting on
The issue didn't come up in previous versions of pytest so I dug a bit and found that
I don't know whether exception classes that look iterable are generally disallowed or if this is something that should be supported/fixed in pytest.
Perhaps you can advise?
Here is some IPython output from my digging:
try: return iter(obj) except TypeError: return iter((obj,))
It works in pytest 3.4.2 where
The text was updated successfully, but these errors were encountered:
If that works then it sounds good!
@backbord are you interested in opening a PR?